05-20-2008
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) than it should write under a seperate file New-list as host1-DEV
Thanks
10 More Discussions You Might Find Interesting
1. IP Networking
I need to list the files that do not match the search pattern:
Example:
cat file1
This is how it should work
cat file2
This is why I like Unix
grep -option? Unix * (or some other command)
returns file1 (1 Reply)
Discussion started by: olapxpert
1 Replies
2. UNIX for Dummies Questions & Answers
I need to list the files that do not match the search pattern:
Example:
cat file1
This is how it should work
cat file2
This is why I like Unix
grep -option? Unix * (or some other command)
returns file1 (7 Replies)
Discussion started by: olapxpert
7 Replies
3. UNIX for Dummies Questions & Answers
Hello,
I am trying to match a string between line one and line two with in the file. But I dont want to search based on the given filename. Instead I want to search for all available files in the specific directory. Please help me on the above. (2 Replies)
Discussion started by: sivakumarvenkat
2 Replies
4. UNIX for Dummies Questions & Answers
Hi guys
I need help in comparing 2 files
for example
file1:
asdf|gdddd|acx
asdf|vcxzz|eww
avxc|bvvce|qwe
file2:
qwer|asdfg|sss
avxc|bvvce|eww
aass|weews|llk
I need to get the lines that are present in file1 but not found in file2.
so in these case (5 Replies)
Discussion started by: khestoi
5 Replies
5. UNIX for Dummies Questions & Answers
>testfile
while read x
do
if then
echo $x >> testfile
else
fi
if then
echo $x >> testfile
else
fi
done < list_of_files
is there any efficient way to search abc.dml and xyz.dml ? (2 Replies)
Discussion started by: dr46014
2 Replies
6. UNIX for Dummies Questions & Answers
I am trying to search for lines present in file a that do not exist in file b and print out the lines. E.g.
file a
apple
pear
banana
orange
file b
apple
banana
orange
would output to stdout: pear.
... (3 Replies)
Discussion started by: thurmc
3 Replies
7. Shell Programming and Scripting
I have a file 1.txt with the below contents.
-----cat 1.txt-----
1234
5678
1256
1234
1247
-------------------
I have 3 more files in a folder
-----ls -lrt-------
A1.txt
A2.txt
A3.txt
-------------------
The contents of those three files are similar format with different data values... (8 Replies)
Discussion started by: realspirituals
8 Replies
8. Shell Programming and Scripting
Hi,
Need your help for this scripting issue I have. I am not really good at this, so seeking your help.
I have a file looking similar to this:
Hello, i am human and name=ABCD.
How are you?
Hello, i am human and name=PQRS.
I am good.
Hello, i am human and name=ABCD.
Good bye.
Hello, i... (12 Replies)
Discussion started by: royzlife
12 Replies
9. UNIX for Dummies Questions & Answers
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
10. Shell Programming and Scripting
how to find multiple lines in to multiple files if matched lines then do
f1 f2 f3 are files ,lines contain matched lines
f1
asdasdasdasd
asdasdasdasd
abc
def
Business date cannot be as of date
ghi
sdasdasdasda
asdasdasdada
f2 (1 Reply)
Discussion started by: Kalia
1 Replies