![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | 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 !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Search a list of lines in file into files | sriram003 | UNIX for Advanced & Expert Users | 2 | 05-20-2008 08:23 AM |
| deleting a varying amount of lines from a list of files | benair | Shell Programming and Scripting | 4 | 04-14-2006 02:48 PM |
| extract lines with a given list of identifiers | mskcc | Shell Programming and Scripting | 3 | 04-14-2006 12:15 AM |
| How will you list only the empty lines in a file (using grep) | JosephGerard | UNIX for Dummies Questions & Answers | 1 | 07-21-2005 04:19 AM |
| list last few lines command | zomboo | UNIX for Dummies Questions & Answers | 2 | 08-18-2004 02:34 PM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
[bash]Stripping lines from a list
Hello! I have a script that is (among other things) doing the following: Code:
list=/tmp/list1.txt ncftpls -u <user> -p <password> -x "-l1" server.domain.tld > $list cat $list | nl echo "Choose file: " read file cat /tmp/list1.txt | nl | grep $file | sed -e "s/$file//g" -e "s/ //g" | column -t > /tmp/list2.txt cat /tmp/list2.txt With this, i want to choose a file that is located on a server and download it. the sed lines was given to me on a guy on another forum who said it should do the trick. And it did, somewhat. In the directory, i have around 40 files. if i choose 1 - 9, it gives me a list with several lines like this Code:
Choose file: 9 2 full_mysql_dump_2008-03-24_0:00.sql.gz full_mysql_dump_2008-03-25_06:00.sql.gz 10 full_mysql_dump_2008-03-25_0:00.sql.gz 18 full_mysql_dump_2008-03-26_0:00.sql.gz 1 full_mysql_dump_2008-03-26_12:00.sql.gz 2 full_mysql_dump_2008-03-28_06:00.sql.gz 30 full_mysql_dump_2008-03-28_0:00.sql.gz 35 full_mysql_dump_2008-03-2_00:00.sql.gz 3 but if i choose a higher number, it gives me this: Code:
Choose file: 33 full_mysql_dump_2008-03-28_18:00.sql.gz Just as i want it to do. In this other script that i am working on, i am using the exact same thing, but this time with another directory on the same remote server, where it is only 2 files. (there will be more files there later). The result is like the first example. It doesn't cut away all the other lines that i don't want to have there. Any of you guys who may know what is wrong, or maybe another solution for my problem? Last edited by noratx; 03-28-2008 at 09:58 PM.. Reason: correcting typos |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|