Skip to main content
13 events
when toggle format what by license comment
Jan 17, 2016 at 9:32 comment added user3566929 @Wildcard he said he doesn't want to revise and escape all the string cause it is a 100 pages long and correct me if i am wrong @Tal .. of course bash is not(it can manipulate a bit with %,:), but i thought he was gonna open a shell anyhow which most probably will be bash so i thought he should trim with bash and then use sed or awk just to do the complex stuff and i think thats easier and faster
Jan 17, 2016 at 9:19 comment added Wildcard @Tal, bash is NOT for string manipulation. At all, at all, at all. It is for file manipulation and command coordination. It happens to have some built in handy functionality for strings, but really limited and not very fast at all if that's the main thing you're doing. See "Why is using a shell loop to process text considered bad practice?" Some tools that are designed for text processing are, in order from most basic to most powerful: sed, awk and Perl.
Jan 17, 2016 at 8:24 comment added Tal AFAIK, tr can replace a single character with a different character - not a keyword with any length string. I also don't see how IFS would help. Is it really that hard to replace a string with another string in linux? The entire bash scripting language is based on string manipulation, and this is one of the most basic operations I can think of.
Jan 17, 2016 at 4:52 comment added user3566929 @Tal bash has tr which is faster ,very useful and less strain full when it comes to computing because it is a built-in ,but of course less powerful and you could also check this stackoverflow.com/questions/918886/… for IFS manipulation<<<<>>>>> but generally what you want to do is very hard and error-prone so you have much trial-and-error to do
Jan 17, 2016 at 4:41 comment added Tal All I need is to replace a keyword with a string. sed seems to be the most common way, by far, to do this in linux. The string can be 100 pages long. I don't want to try to sanitize the string so that sed doesn't freak out when reading it - I want it to be able to handle any characters in the string, and by "handle", I mean not try to find magical meaning within.
Jan 17, 2016 at 1:20 comment added user3566929 @Tal why do you want to prevent it from interpreting? i mean that is the use of sed in the first place, what is your project?
Jan 17, 2016 at 1:11 history edited user3566929 CC BY-SA 3.0
added 43 characters in body
Jan 17, 2016 at 1:10 comment added user3566929 @Tal no it can take anything instead of / and it will ignore the / happily as i just pointed out .. in fact , you can even look for it and replace it in a string >>> i have edited with an example >>>these stuff are not that safe and you always will find a smarter dude
Jan 17, 2016 at 1:05 comment added Tal You are talking about allow the use of a single, specific character in the replacement string - in this case, "/". I'm talking about preventing it from trying to interpret the replacement string altogether. No matter what character you use ("/", ",", "|", etc) you always risk having that character pop up in the replacement string. Also, the initial character is not the only special character that sed cares about, is it?
Jan 17, 2016 at 0:58 history edited user3566929 CC BY-SA 3.0
added 286 characters in body
Jan 17, 2016 at 0:49 history edited user3566929 CC BY-SA 3.0
added 286 characters in body
Jan 17, 2016 at 0:42 history edited user3566929 CC BY-SA 3.0
added 286 characters in body
Jan 17, 2016 at 0:34 history answered user3566929 CC BY-SA 3.0