|
|
|
|
google site
|
|||||||
| Forums | Register | Blog | Man Pages | Forum Rules | Links | Albums | FAQ | Users | Calendar | 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 Tools | Search this Thread | Rate Thread | Display Modes |
|
|||
|
delete multiple lines by line number
I have been googling, but cannot find that works for me.
I have a text file tmp.out with contents: sadfsdf sdfosuidhfousdhof soduhf osdfu osudfhosudhfd sdfgsdfg asdfiojhsdf asdoludhflsdjfhskldjfhsdjdlfsjdhnlj h sdja ouahsdjdafkljsa oljhljh I have another file tmp_memrecno.dat that has numbers: 5 3 I want to delete lines (read from tmp_memrecno.dat) from file tmp.out. Here is what I have so far, but doesn't really work: while read line do sed "$line"'d' test.out > tmp.out done < tmp_memrecno.dat Basically, the end result of file test.out should be sadfsdf sdfosuidhfousdhof soduhf osdfu osudfhosudhfd sdfgsdfg ouahsdjdafkljsa |
| Sponsored Links |
|
|
|
|||
|
Quote:
Syntax Error The source line is 5. The error context is } >>> tmp_memrecno. <<< dat tmp.out > tmp.newfile awk: 0602-500 Quitting The source line is 5. |
|
|||
|
Code:
awk -v tmp1="$tmp1" -v tmp2="$tmp2" ' { print tmp1, tmp2} ' somefile |
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Tags |
| unix commands |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| 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 10:19 AM |
| regex to delete multiple blank lines in a file? | fedora | Shell Programming and Scripting | 6 | 10-11-2007 05:36 PM |
| Need to delete multiple lines in a file. | kangdom | Shell Programming and Scripting | 6 | 10-16-2006 12:02 PM |
| delete multiple empty lines | whatisthis | Shell Programming and Scripting | 3 | 11-09-2005 05:42 PM |
| Delete multiple lines w/ sed | bookoo | Shell Programming and Scripting | 2 | 07-25-2003 11:03 AM |