![]() |
|
|
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 |
| Find match in two diff file - local srv and remote server | amir07 | Shell Programming and Scripting | 0 | 03-07-2008 10:23 AM |
| combining 2 files with more than one match in second file | johnes42 | Shell Programming and Scripting | 5 | 12-04-2007 06:58 AM |
| How to match a logical partition to a file | garry | AIX | 1 | 09-26-2007 10:52 AM |
| how to search string and number in one file and check in the other file | knshree | Shell Programming and Scripting | 9 | 08-24-2007 05:29 AM |
| Posix string to match [[0-999]] | Mair55 | UNIX for Dummies Questions & Answers | 11 | 10-16-2005 12:07 AM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
match string in a file to file in a directory
Hello awk gurus,
I have a text file (st15.txt) containing many station ids. st15.txt: 033445 234567 012345 222345 . . . And, I want to match each station number to individual files in a directory, and then I would like to copy that file into a different folder if any station id matches to a file. For example, "ls *.DAT" shows all files in the current directory. Q012345.DAT Q033445.DAT Q123456.DAT Q222345.DAT X234567.DAT X345678.DAT . . If you look at "st15.txt", ONLY 4 stations are matching the files in the current directory. Thus, 033445 matches Q033445.DAT 234567 matches X234567.DAT 012345 matches Q012345.DAT 222345 matches Q222345.DAT So, all these 4 *.DAT files should be copied into a new directory. I think that awk would be the solution, but I don't know how to attack this problem. Thanks, Jae |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|