09-24-2002
Re: How to grep in order based on the input file
Quote:
Originally posted by Kelam_Magnus
for name in `cat file.1 `
do
grep $name file.2
done > file.3
Does the "> file.3" on the outside of the done statement actually work? When I first saw the segment of code I thought, "Hey! He's gonna overwrite all those responses with an "echo done!"" Then I looked at it closer.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
I am new to unix shell programming.
I want to write a shell script for a functionality existing in mainframe system.
I have one file as below as input
123456
&__987
&12yuq
abcdef
_ referes to blank
condition:whenever the input file is having &__ ,it should be replaced... (4 Replies)
Discussion started by: charan0703
4 Replies
2. Shell Programming and Scripting
Hi All, I need to grep few files which has words like the below in the file name , which i want to put it in a file and and grep for the files which contain these names and move it to a new directory ,
full file name -C20091210.1000-20091210.1100_SMGBSC3:1000... (2 Replies)
Discussion started by: anita07
2 Replies
3. Shell Programming and Scripting
Hello,
I have File1 in a directory A, a File2 in a directory B.
If the File2 is not empty
Then I have to move File1 from directory A to a directory archive
Else no action.
Is it possible to do this from one command line?
Thank you in advance for your answers.
Madi (2 Replies)
Discussion started by: AngelMady
2 Replies
4. UNIX for Dummies Questions & Answers
Hi All,
I have a large text file which is a combination of multiple files. This is what I used and it worked.
for i in /home/docs/text/*
do
cat $i >> Single_File
done
Now wondering, if there is a way to sort that single large file based on timestamps in ascending order. Text file... (11 Replies)
Discussion started by: prrampalli
11 Replies
5. Shell Programming and Scripting
I have a file in which the data is stored in pairs of lines. The first line (beginining with ">") is a header, the second line is a sequence.
I would like to sort the file by species name. Desired output for the example file:
I can use
sort -t'_' -k2
to alphabetize headers in the... (1 Reply)
Discussion started by: pathunkathunk
1 Replies
6. Shell Programming and Scripting
Dear Friends,
I am looking for a shell script to merge input files into one file .. here is my idea:
1st paramter would be outfile file (all input files content)
read all input files and merge them to input param 1
ex: if I pass 6 file names to the script then 1st file name as output file... (4 Replies)
Discussion started by: hyd1234
4 Replies
7. Shell Programming and Scripting
Hi
I need to order these lines from a txt file my file looks like this
IMSI ........................ 1234567890
APN ......................... INTERNET.COM
APN ......................... MMS.COM
APN ......................... WAP.COM
APN ......................... BA.COM
IMSI... (4 Replies)
Discussion started by: alone77
4 Replies
8. Shell Programming and Scripting
In the below bash a file is downloaded when the program is opened and then that file is searched based on user input and the result is written to a new file.
For example, the bash is opened and the download.txt is downloaded, the user then enters the id (NA04520). The id is used to search... (5 Replies)
Discussion started by: cmccabe
5 Replies
9. Shell Programming and Scripting
Hi All,
I have one file containing thousands of table names in single column. Now I want that file split into multiple files e.g one file containing table names starting from A, other containing all tables starting from B...and so on..till Z.
I tried below but it did not work.
for i in... (6 Replies)
Discussion started by: shekhar_4_u
6 Replies
10. Shell Programming and Scripting
This script is running some exe file we are passing three argumnet below custome key word
Want to update script based on input files every time it will take argument from input file
below is the input files should take this input put it into the script.
k.ksh
cd /u/kali/temp
... (8 Replies)
Discussion started by: Kalia
8 Replies