![]() |
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 |
| Shell Script for deleting the first line in a file | badrimohanty | Shell Programming and Scripting | 3 | 06-18-2009 11:26 AM |
| shell script reqd - deleting files | venkatesht | Shell Programming and Scripting | 2 | 12-19-2008 01:15 PM |
| Deleting column from a flatfile with delimiter | rsprabha | Shell Programming and Scripting | 5 | 10-03-2008 04:18 AM |
| Urgent help required in deleting a line without opening a file usinga shell script | naan | Shell Programming and Scripting | 6 | 07-20-2006 03:42 AM |
| shell script: deleting files from a directory | onlyc | Shell Programming and Scripting | 1 | 07-09-2006 06:41 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Quote:
You can use the below command to delete the invalid line. cat data | awk '{ if(substr($1,1,5)!="" && substr($1,6,10)!="" && substr($1,11,12)!="") print $1}' > new_filtered_file_name. Where the data is the input file. Thanks, chidhu |
|
||||
|
Thanks for your replies ..i ll try it and update
---------- Post updated 06-26-09 at 03:20 AM ---------- Previous update was 06-25-09 at 03:54 AM ---------- I donot want to redirect to any new file. I want to delete the line from the file itself. I have tried sed -i '3d' to delete the 3rd line. But my shell is not recognizing sed -i. I have tried sed '3d' <filename> ..it is displaying the file without the 3rd line. But the 3rd line is not permanently deleted. Can anyone please help |
|
||||
|
Quote:
Code:
sed '3d' file | tee file |
|
||||
|
Thank you..this is working..
|
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Tags |
| sed, shell script, unix |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|