Sponsored Content
Top Forums Shell Programming and Scripting Take a list if strings from a file and search them in a list of files and report them Post 302543034 by realspirituals on Friday 29th of July 2011 12:56:18 PM
Old 07-29-2011
The same example works fineSmilie. But when I apply the same to a real time scenario. It is not working.Smilie.
Code:
awk 'NR==FNR{a[$0]=1}$19 in a{print FILENAME":"$0}' 2.txt $RESPONSE_DIR/DOWNLOAD*.dat > 2matches.txt

I try to get a list of files from RESPONSE_DIR, the position is 19.
19th position is the last position in the file. Also there may be spaces with in the values ...

---------- Post updated at 11:56 AM ---------- Previous update was at 07:26 AM ----------

Also this is not working for more than 200 records. Smilie

Last edited by radoulov; 07-31-2011 at 05:35 PM.. Reason: Code tags.
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Search a list of lines in file into files

I have a file (file1) which is like host1 host2 host3 host4 the list goes on............ Now I want the above lines in files to be compared with files under /opt/new/ File names are as below: Dev Prod QA And suppose host1 from file1 is found under Dev(file under /opt/new)... (2 Replies)
Discussion started by: sriram003
2 Replies

2. Shell Programming and Scripting

list and export strings in a file

Hi all, I have a file looks something like this: ~~~~~~~~~~~~~~~~~~~~~~~~~ aaaa bbbbbb ccc dddddddd ~~~~~~~~~~~~~~~~~~~~~~~~~ I will like a script that can echo line1 export line1 as env variable echo line2 export line2 as env variable etc etc Thanks in advance (3 Replies)
Discussion started by: Avatar Gixxer
3 Replies

3. Shell Programming and Scripting

Want unix script to search a list of strings

Want unix script to search a list of strings (stored line by line in a file), search all the matching lines of files under directories and subdirectories in different unix machines(not one box diff boxes - all the unix box names and username/password are stored with a comma delimitor in flat file)... (2 Replies)
Discussion started by: adminuser
2 Replies

4. Shell Programming and Scripting

Awk search for a element in the list of strings

Hi, how do I match a particular element in a list and replace it with blank? awk 'sub///' $FILE list="AL, AK, AZ, AR, CA, CO, CT, DE, FL, GA, HI, ID, IL, IN, IA, KS, KY, LA, ME, MD, MA, MI, MN, MS, MO, MT, NE, NV, NH, NJ, NM, NY, NC, ND, OH, OK, OR, PA, RI, SC, SD, TN, TX, UT, VT, VA, WA,... (2 Replies)
Discussion started by: grossgermany
2 Replies

5. UNIX for Dummies Questions & Answers

Find Multiple Strings from a list of *.gz files withour decompressing...

Hello Team, There is this situation where there are around 20 *.gz files and i want to search multiple words from all those files. Example as below : filea.gz fileb.gz filec.gz now i want to search words "hi" and "hello" from all these 3 files without... (4 Replies)
Discussion started by: varun87
4 Replies

6. Shell Programming and Scripting

Match list of strings in File A and compare with File B, C and write to a output file in CSV format

Hi Friends, I'm a great fan of this forum... it has helped me tone my skills in shell scripting. I have a challenge here, which I'm sure you guys would help me in achieving... File A has a list of job ids and I need to compare this with the File B (*.log) and File C (extend *.log) and copy... (6 Replies)
Discussion started by: asnandhakumar
6 Replies

7. Shell Programming and Scripting

Searching for a list of strings in a file with Python

Hi guys, I'm trying to search for several strings, which I have in a .txt file line by line, on another file. So the idea is, take input.txt and search for each line in that file in another file, let's call it rules.txt. So far, I've been able to do this, to search for individual strings: ... (1 Reply)
Discussion started by: starriol
1 Replies

8. UNIX for Dummies Questions & Answers

Search list of files

Hi All, I Have 2 files. file1: abc.xml.gz abcd.xml.gz xyz.xml.gz X.xml.gz File2 abc. x. cde. unix. My requirment is search File1 using File2 and need below ouput. (6 Replies)
Discussion started by: j.vutakanti
6 Replies

9. UNIX for Beginners Questions & Answers

Using find to output list of files with specific strings

This is my problem, I am using the following code to extract the file names with specific strings 0.01: find ./ -name "*.txt" -exec grep -H '0.01' {} + It works wonders with a small sample. However, when I use it in a real scenario it produces an empty file -even though I am sure there are... (11 Replies)
Discussion started by: Xterra
11 Replies

10. UNIX for Beginners Questions & Answers

How to pass strings from a list of strings from another file and create multiple files?

Hello Everyone , Iam a newbie to shell programming and iam reaching out if anyone can help in this :- I have two files 1) Insert.txt 2) partition_list.txt insert.txt looks like this :- insert into emp1 partition (partition_name) (a1, b2, c4, s6, d8) select a1, b2, c4, (2 Replies)
Discussion started by: nubie2linux
2 Replies
IPC::SysV(3perl)					 Perl Programmers Reference Guide					  IPC::SysV(3perl)

NAME
IPC::SysV - System V IPC constants and system calls SYNOPSIS
use IPC::SysV qw(IPC_STAT IPC_PRIVATE); DESCRIPTION
"IPC::SysV" defines and conditionally exports all the constants defined in your system include files which are needed by the SysV IPC calls. Common ones include IPC_CREATE IPC_EXCL IPC_NOWAIT IPC_PRIVATE IPC_RMID IPC_SET IPC_STAT GETVAL SETVAL GETPID GETNCNT GETZCNT GETALL SETALL SEM_A SEM_R SEM_UNDO SHM_RDONLY SHM_RND SHMLBA and auxiliary ones S_IRUSR S_IWUSR S_IRWXU S_IRGRP S_IWGRP S_IRWXG S_IROTH S_IWOTH S_IRWXO but your system might have more. ftok( PATH ) ftok( PATH, ID ) Return a key based on PATH and ID, which can be used as a key for "msgget", "semget" and "shmget". See ftok. If ID is omitted, it defaults to 1. If a single character is given for ID, the numeric value of that character is used. shmat( ID, ADDR, FLAG ) Attach the shared memory segment identified by ID to the address space of the calling process. See shmat. ADDR should be "undef" unless you really know what you're doing. shmdt( ADDR ) Detach the shared memory segment located at the address specified by ADDR from the address space of the calling process. See shmdt. memread( ADDR, VAR, POS, SIZE ) Reads SIZE bytes from a memory segment at ADDR starting at position POS. VAR must be a variable that will hold the data read. Returns true if successful, or false if there is an error. memread() taints the variable. memwrite( ADDR, STRING, POS, SIZE ) Writes SIZE bytes from STRING to a memory segment at ADDR starting at position POS. If STRING is too long, only SIZE bytes are used; if STRING is too short, nulls are written to fill out SIZE bytes. Returns true if successful, or false if there is an error. SEE ALSO
IPC::Msg, IPC::Semaphore, IPC::SharedMem, ftok, shmat, shmdt AUTHORS
Graham Barr <gbarr@pobox.com>, Jarkko Hietaniemi <jhi@iki.fi>, Marcus Holland-Moritz <mhx@cpan.org> COPYRIGHT
Version 2.x, Copyright (C) 2007-2010, Marcus Holland-Moritz. Version 1.x, Copyright (c) 1997, Graham Barr. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.14.2 2011-09-19 IPC::SysV(3perl)
All times are GMT -4. The time now is 06:48 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy