![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Removing the first and last lines in a file | naveendronavall | Shell Programming and Scripting | 2 | 12-29-2007 10:22 PM |
| Removing the first and last lines in a file | naveendronavall | AIX | 1 | 12-29-2007 08:44 PM |
| Removing lines within a file | tookers | Shell Programming and Scripting | 3 | 08-22-2006 06:49 AM |
| Removing lines from a file | PradeepRed | Shell Programming and Scripting | 4 | 12-17-2005 03:34 AM |
| Removing lines in a text file. | WABonnett | Shell Programming and Scripting | 4 | 11-25-2003 08:27 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Removing lines from a file
I'm trying to find a command which will allow me to remove a range of lines (2-4) from a .dat file from the command line without opening the file.
Someone mentioned using the ex command? Does anyone have any ideas? thanks |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
Code:
sed '2,4d' oldfile > newfile mv newfile oldfile |
|
#3
|
|||
|
|||
|
Thank you!
|
|
#4
|
|||
|
|||
|
Is there a way of substituting one word for another word, in the same manner?
|
|
#5
|
|||
|
|||
|
After u open the File in vi editor
:s/oldword/newword/g Does replacing old word with new one everywhere in the file. |
|
#6
|
||||
|
||||
|
Quote:
Last edited by vgersh99; 11-14-2006 at 03:52 PM. |
|
#7
|
|||
|
|||
|
Quote:
:%s/oldword/newword/g |
|||
| Google The UNIX and Linux Forums |