This is a discussion on Little problem with sed within the Shell scripting forums, part of the Development/Scripting category; Hello, I'm using sed to replace n occurrences. But when I wan to replace my 10th occurrence with the \10, ...
|
|||||||
| Register | FAQ | Members List | Calendar | Forgotten your password? | Mark Forums Read |
|
|||
|
Hello,
I'm using sed to replace n occurrences. But when I wan to replace my 10th occurrence with the \10, I get replaced with the first occurrence and the number 0. Here is part of my command: s:\([0-9];\)\([0-9];\)\([0-9];\)......\([0-9];\)\([0-9];\):\1,\2,\3......,\10,\11:g I have tried '\10' etc.. but I don't find the exact expression. Can you help me please? |
| Sponsored Links | ||
|
|
|
|||
|
I am new to shell scripting, and i have many files that need editing. My problem is some lines end with a / and I need to find the next line after this and join the two together.
I have found the following one liners but i am unable to rearrange them to come up with what i need. script 1: # if a line ends with a backslash, append the next line to it /bin/sed -e :a -e '/\\$/N; s/\\\n//; ta' < input.file> output.file script 2: # if a line begins with an equal sign, append it to the previous line # and replace the "=" with a single space #/bin/sed -e :a -e '$!N;s/\n=/ /;ta' -e 'P;D' < input.file> output.file I would be grateful is someone could point me in the right direction, all the help files and faqs i have come across do not show all posiblities and / or what all the characters mean. thanks |