Script to read multiple files...


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Script to read multiple files...
# 8  
Old 11-13-2013
See post#2.
# 9  
Old 11-13-2013
This one solves a specific problem that matches your vague description.
Code:
awk 'NR==FNR {a[$0]; bf=FILENAME; next} ($0 in a) {delete a[$0]; next} {print FILENAME,":",$0,"not in",bf} END {for (i in a) print bf,":",i,"not in any file"}' bigfile f1 f2 f3 f4 f5 f6 f7

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

In PErl script: need to read the data one file and generate multiple files based on the data

We have the data looks like below in a log file. I want to generat files based on the string between two hash(#) symbol like below Source: #ext1#test1.tale2 drop #ext1#test11.tale21 drop #ext1#test123.tale21 drop #ext2#test1.tale21 drop #ext2#test12.tale21 drop #ext3#test11.tale21 drop... (5 Replies)
Discussion started by: Sanjeev G
5 Replies

2. UNIX for Dummies Questions & Answers

awk - how to read multiple files

Hi, is there a ways to read multiple files in a single awk command? For example: awk -f awk_script file1 file2 file3 I've google it, most of them suggest using FNR. But I don't understand how it works. It will be a great help if someone able to explain it in simple term with some example. (4 Replies)
Discussion started by: KCApple
4 Replies

3. Shell Programming and Scripting

read the lines of multiple files

I am trying to create a script which will read 2 files and use the lines of file 1 for each line on file 2. here's my sample code cat $SBox | while read line do cat $Date | while read line do $SCRIPTEXE <line from first file> $2 <line from 2nd file> ... (12 Replies)
Discussion started by: khestoi
12 Replies

4. UNIX for Advanced & Expert Users

Use awk to read multiple files twice

Hi folks I have a situation where I am trying to use awk to compute mean and standard deviation for a variable that spans across multiple files. The layout of each file is same and arranged in 3 columns and uses comma as a delimiter. File1 layout: col1,col2,col3 0,0-1,0.2345... (13 Replies)
Discussion started by: scandy
13 Replies

5. Shell Programming and Scripting

Multiple files read error in Shell

Hi All, there is a script that reads multiple files in a directory starting with CTG_TMPxx where xx is an integer number. i have a problem in readin the last file. For example, if there are 10 files in that directory, 9 files are read and processed. but the 10th file, its saying as cannot read... (1 Reply)
Discussion started by: vkca
1 Replies

6. Shell Programming and Scripting

Read and edit multiple files using a while loop

Hi all, I would like to simply read a file which lists a number of pathnames and files, then search and replace key strings using a few vi commands: :1,$s/search_str/replace_str/g<return> but I am not sure how to automate the <return> of these vis commands when I am putting this in a... (8 Replies)
Discussion started by: cyberfrog
8 Replies

7. Shell Programming and Scripting

How to Read Multiple files in a Shell Script

Hi, Can any one tell me if i can read two files in a shell script... My actual requirement is to read the 1st text file and parse it to get the file code and use this file code to retrieve data from database and print the fetched data in the 2nd text file (I have parsed it and printed the... (2 Replies)
Discussion started by: funonnet
2 Replies

8. Shell Programming and Scripting

Read the data from multiple files and sum the value

Hi all, I have a requirement where i have to read multiple files using Shell Script in Korn Shell. each file will have the 3rd line as the amount field, i have to read this amount field and sum it for all the files. any idea on how to achieve this?? (i think i can achieve it using a loop,... (9 Replies)
Discussion started by: nvuradi
9 Replies

9. Shell Programming and Scripting

Shell script to read multiple log files

Hi all, I have to generate some report from shell script .We have stacktrace log file which generate hourly basis. So now my q is that how this shell script will read all stacktrace log file for particlular day and parse accordingly desire output. Any help or suggestion as i am newbie with... (1 Reply)
Discussion started by: esungoe
1 Replies

10. Shell Programming and Scripting

How to read from multiple files

Hi All, I have list of multiple files with 7 fields all together. Those are being split to exact lines of 20000 each. xaa xab : : : xhx Please advise me how to read from those files and in fact I need to invoke and sql update statement for each inputs values.. Regards, (5 Replies)
Discussion started by: cedrichiu
5 Replies
Login or Register to Ask a Question