![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Rules & FAQ | Contribute | Members List | Arcade | 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 here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Appending line number to each line and getting total number of lines | chiru_h | Shell Programming and Scripting | 2 | 03-25-2008 06:19 AM |
| extract a line from a file using the line number | grandtheftander | Shell Programming and Scripting | 6 | 02-06-2008 02:12 AM |
| Appending the line number and a seperator to each line of a file ? | pjcwhite | Shell Programming and Scripting | 4 | 03-20-2007 09:29 PM |
| Unix Script with line number at beginning of each line. | mascorro | Shell Programming and Scripting | 5 | 06-19-2006 01:34 PM |
| identifying duplicates line & reporting their line number | stresslog | UNIX for Dummies Questions & Answers | 5 | 04-23-2006 09:43 PM |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
Hi,
I have a huge file & I want to add a specific text in column. But I want to add this text from a specific line number to a specific line number & another text in to another range of line numbers. To be more specific: lets say my file has 1000 lines & 4 Columns. I want to add text "Hello" to 5th column but from line 1 to line 200. & I want to add another text "goodbye" to 5th column of the same file from line 201 to 800 & another text "live" again to 5th column to the same file from line 801 to 1000. I know I can use sed to add a column to my file but I don't know how to tell sed to add this column to from line & to to line. Code:
$ sed 's/\(.*\) \(.*\) \(.*\) \/\1 \2 \3 \ Desired string/' input > output May be there is a way to do it in sed or may be awk? Any help will be very welcome. Thanks in advance, Ezy |
| Forum Sponsor | ||
|
|