![]() |
|
|
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 |
| bash while read how to remove \n character | papasj | Shell Programming and Scripting | 3 | 05-25-2009 10:24 PM |
| Remove duplicate text | dejavu88 | Shell Programming and Scripting | 7 | 06-08-2008 05:37 PM |
| Remove html tags with bash | dejavu88 | Shell Programming and Scripting | 4 | 05-22-2008 02:58 PM |
| remove lines in text starting with . (period) | Movomito | UNIX for Dummies Questions & Answers | 11 | 04-24-2008 11:19 AM |
| command find returned bash: /usr/bin/find: Argument list too long | yacsil | Shell Programming and Scripting | 1 | 12-15-2003 06:38 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
bash find and remove text
Here's the story:
I have two txt files of filenames one is like this W00CHZ0103340-I1CZ31 W00CHZ0103340-I1CZ32 W00CHZ0103340-I1CZ33 W00CHZ0103341-I1CZ35 W00CHZ0103342-I1CZ46 W00CHZ0103343-I1CZ37 W00CHZ0103344-I1CZ39 W00CHZ0103345-I1CZ43 W00CHZ0103345-I1CZ44 ... the other like this W00CHZ0103340/images/W00CHZ0103340-I1CZ31/ W00CHZ0103340/images/W00CHZ0103340-I1CZ32/ W00CHZ0103340/images/W00CHZ0103340-I1CZ33/ W00CHZ0103341/images/W00CHZ0103341-I1CZ35/ W00CHZ0103342/images/W00CHZ0103342-I1CZ46/ W00CHZ0103343/images/W00CHZ0103343-I1CZ37/ W00CHZ0103344/images/W00CHZ0103344-I1CZ39/ W00CHZ0103345/images/W00CHZ0103345-I1CZ43/ W00CHZ0103345/images/W00CHZ0103345-I1CZ44/ I want to remove all the text up to and including images/ and then the final / then i would be left with identical lists. On list comes from an ls command and the other from some type of manifest that i am checking against. I need to do this so that i can then compare the two for unique entries and thereby find out what's missing. Please Help me |
|
||||
|
Quote:
#!/bin/bash cat secondfile.txt | while read line do FN=`echo $line | awk -F\/ '{print $(NF-1)}' ` echo $FN done |
|
||||
|
now i have just one more question. I left work already where i need to try and use this script but it will drive me nuts all weekend if i don't get this thing licked. Will the above responses work even if the parameters following the W above change? for example sometimes the filenames change to W23704/images...etc It always starts with W but the proceeding characters can be a hadge podge of numbers and letters and not always the same number. Again, any help is really appreciated. I just want to know that i've got it come monday.
|
|
||||
|
Quote:
Regards |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|