No, There isn't. The problem is that you don't realize that most sed implementations do not support a \n escape sequence in the replacement text of a substitution command.
Quote:
Originally Posted by marek
Now lets try with a tab:
That means my shell has problems to interpret well the '\'
No. As with \n, most sed implementations do not support a \t escape sequence in the replacement text of a substitution command.
Quote:
Originally Posted by marek
No lets try your suggestion:
This is due to how the shell treats a backslash at the end of a line within a double quoted string.
Quote:
Originally Posted by marek
same for 's ... '
You made a mistake, because within single quotes, a backslash is not special and if it immediately precedes the newline then sed will be happy.
You should spend some time with both your shell and sed documentation.
Regards,
Alister
P.S. Above, when I say "most", I mean all except GNU sed.
tcsh has many design flaws, such as this one. I suggest using any shell but tcsh, where strings containing newlines will be valid instead of syntax errors.
I'd like to question your presuppositions: why do you need to put newlines into your PATH variable? If it is because you want to work on its parts in a loop of some sort this might also work for you, without the need for "sed" or any other tool:
Example:
I have server name A with an IP : 125.252.235.455
I have an username /password to login into this server under SSH connection
In this server i have a path /apps/user/filename(Big.txt)
Everyday we used to get the filename as Big.txt.
I want a shell script to monitor this path... (4 Replies)
I have developed a script that transfers files from a UNIX machine to a Windows machine. Transferring the files is working perfectly, but my echo statements are displaying the destination (Windows) path names incorrectly.
I understand that it is the "\" that is causing this, but is there anyway... (5 Replies)
Hi I'm trying to select text between two lines, I'm using sed to to this, but I need to pass variables to it. For example
start="BEGIN /home/mavkoup/data"
end="END"
sed -n -e '/${start}/,/${end}/g' doesn't work. I've tried double quotes as well. I think there's a problem with the / in the... (4 Replies)
I need to run my shell script just by typing its name rather than doing sh <scrpit name>. I think its something to do with my profile and path.
echo $path is giving me output as follows:
sr/games /opt/gnome/bin /opt/kde3/bin /usr/bin/X11 /usr/local/bin /usr/bin /bin /usr/sbin /sbin... (3 Replies)
This is on a Solaris 9 box, but I feel like a noob, so I am posting here. When I echo $PATH I get a lot of duplicate paths and extra stuff I don't need. What I want is just what I set up in my home dir under .profile
My login shell=/bin/bash
I checked the following and there are no path... (1 Reply)