![]() |
|
|
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 |
| Delete first line from file and more.... | dfb500 | Shell Programming and Scripting | 6 | 07-02-2009 11:04 AM |
| Delete a line from a file | rohini | UNIX for Dummies Questions & Answers | 8 | 01-07-2009 06:34 AM |
| How to delete line from a file | ramezernest | UNIX for Dummies Questions & Answers | 0 | 11-01-2007 11:56 AM |
| delete line in file with sed | forever_49ers | Shell Programming and Scripting | 8 | 09-12-2007 09:39 AM |
| Delete line(s) from file | elchalateco | UNIX for Dummies Questions & Answers | 4 | 10-11-2002 02:25 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
delete line in a file
Hi all,
I would like to delete a line in file.txt which has a list of filename. example: file_a file_b file_c lets say i have file_b in my directory, then i should delete file_b in file.txt and get output file.txt with only file_a and file_b. Below is my script, my result is still file_a file_b file_c Anyone can help??? #!/bin/bash while read line do if [[ -r $line ]] then sed -e '/$line/d' $1 > $1.tmp mv $1.tmp $1 else echo "file not readable" fi done < $1 |
|
||||
|
Quote:
|
|
|||||
|
Quote:
|
![]() |
| Bookmarks |
| Tags |
| sed delete line |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|