![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| extract a line from a file using the line number | grandtheftander | Shell Programming and Scripting | 7 | 01-22-2009 10:24 AM |
| Extract a line from a file using the line number | zambo | Shell Programming and Scripting | 1 | 05-01-2008 01:39 PM |
| Appending line number to each line and getting total number of lines | chiru_h | Shell Programming and Scripting | 2 | 03-25-2008 10:19 AM |
| Appending a line in a file after a particular line | maxvirrozeito | Shell Programming and Scripting | 7 | 12-12-2007 01:58 PM |
| Get line form file by line number | corny | Shell Programming and Scripting | 3 | 08-25-2006 12:18 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Hi, I am a newb as far as shell scripting and SED goes so bear with me on this one.
I want to basically append to each line in a file a delimiter character and the line's line number e.g Change the file from :- aaaaaa bbbbbb cccccc to:- aaaaaa;1 bbbbbb;2 cccccc;3 I have worked out how to append the ";" to the end of each line ( sed '1,$s/$/;/') but am stumped with the line number bit . This is on a Sun Solaris box btw. Any help appreciated. Thanks Paul |
|
||||
|
Code:
cat -n filename |sed 's/\(.*\)\([0-9][0-9]*\)\(.*\)/\3;\2/' |
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|