09-08-2006
Pipe Data From Grep Into A File
I am somewhat of a novice at unix scripting and I need a little help. Here is what im trying to do:
I am trying to figure out how to pipe the following grep results into a file.
/source/programs: grep "WSBL020" W*
WBMB991.cbl: COPY WSBL020.
WDCB003.cbl: COPY WSBL020.
WDCB004.cbl: COPY WSBL020.
WOVB020.cbl:000926 COPY WSBL020
I only want the first 7 characters of each line of results preceeded by "compile". What I want is a file that looks like the following:
compile WBMB991
compile WDCB003
compile WDCB004
compile WOVB020
I have a copybook that has changed and I need to recompile about 200 programs and I was trying to figure out an easy way to do it.....please help!
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
hi,
How can I check for a field in a pipe-delimited file having a NULL value in Unix using a grep command or any other command.
Please reply (5 Replies)
Discussion started by: sureshg_sampat
5 Replies
2. UNIX for Dummies Questions & Answers
Hi All,
I have a pipe delimited text file look like below with many records and columns...
File Name: sample1.txt:
col1|col2|col3|col4|col5|col6|col7|col8|col9|.....
col1|col2|col3|col4|col5|col6|col7|col8|col9|.....
col1|col2|col3|col4|col5|col6|col7|col8|col9|.....
.
.
.
I would... (2 Replies)
Discussion started by: Meem
2 Replies
3. Shell Programming and Scripting
helo all
i have 2 files. and i want to grep the contents of first file from the 2nd file. but these files are too large contaning lacks of lines .
i'm using for loop but it takes so moch times . is there any other sol.
i'm using this code
"
for var in `cat succ_migrated`
do
grep $var... (4 Replies)
Discussion started by: dodasajan
4 Replies
4. UNIX for Dummies Questions & Answers
Dear unix gurus,
I have a data file with header information about a subject and also 3 columns of n rows of data on various items he owns. The data file looks something like this:
adam peter
blah blah blah
blah blah blah
car
01 30 200
02 31 400
03 57 121
.. .. ..
.. .. ..
n y... (8 Replies)
Discussion started by: tintin72
8 Replies
5. UNIX for Dummies Questions & Answers
Hi -- I'm looking to write to a file after piping output from tail -f through to grep:
#write to a file for all lines with "searchtext" within in error_log:
Expand|Select|Wrap|Line Numbers
tail -f /var/error_log | grep searchtext > output.txt
The above command... (2 Replies)
Discussion started by: ndedhia1
2 Replies
6. Shell Programming and Scripting
Hi,
I have one file, say file 1, that has data like below where 19900107 is the date,
19900107 12 144 129 0.7380047
19900108 12 168 129 0.3149017
19900109 12 192 129 3.2766666E-02
... (3 Replies)
Discussion started by: Wynner
3 Replies
7. UNIX for Dummies Questions & Answers
I am using grep to match a pattern, but the output is strange.
$ grep -r -o "pattern" *
Gives me:
Binary file foo1 matches
Binary file foo2 matches
Binary file foo3 matches
To find the lines before/after, I then have to use the following on each file:
$ strings foo1 | grep -A1 -B1... (0 Replies)
Discussion started by: chipperuga
0 Replies
8. UNIX for Dummies Questions & Answers
Hello.
I want to get all modules which are loaded and which name are exactly 2 characters long and not more than 2 characters and begin with "nv"
lsmod | (e)grep '^nv????????????
I want to get all modules which are loaded and which name begin with "nv" and are 2 to 7 characters long
... (1 Reply)
Discussion started by: jcdole
1 Replies
9. Shell Programming and Scripting
Hi guys,
I need to know how i can ignore Pipe '|' if Pipe is coming as a column in Pipe delimited file
for eg:
file 1:
xx|yy|"xyz|zzz"|zzz|12...
using below awk command
awk 'BEGIN {FS=OFS="|" } print $3
i would get xyz
But i want as :
xyz|zzz to consider as whole column... (13 Replies)
Discussion started by: rohit_shinez
13 Replies
10. Shell Programming and Scripting
I have a file as below
Emp1|FirstName|MiddleName|LastName|Address|Pincode|PhoneNumber
1234|FirstName1|MiddleName2|LastName3| Add1 || ADD2|123|000000000
2345|FirstName2|MiddleName3|LastName4|
Add1 || ADD2|
234|000000000
OUTPUT :
... (1 Reply)
Discussion started by: styris
1 Replies