Combine awk Or Grep Input


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Combine awk Or Grep Input
# 1  
Old 08-02-2015
Combine awk Or Grep Input

Code:
grep -ia '^Windows Installer' Galant01.txt Galant02.txt | awk -F '\t' '{print substr($1,1,index($1,":")) $4 "<br>"}' ;

The output produces:
Code:
Galant01.txt:Manual<br> Galant02.txt:Manual<br>

It will be good to show instead:
The output produces:
Code:
Galant01.txt,Galant02.txt:Manual<br>

The idea is to combine the similar input together and to leave the below intact:
Code:
Galant01.txt:Automatic <br>Galant02.txt:Manual<br>

This is for one case, but say if I want to do it in bulk see below

Last edited by alvinoo; 08-02-2015 at 10:58 PM..
# 2  
Old 08-02-2015
I'm afraid there's something essential missing. Neither of your input files has sth like 1.1.1.1.1 or so in it. So I don't see any connection between your initial grep for ^Windows Installer and the desired output.
# 3  
Old 08-02-2015
Hi Rubi,

Forget mydesire data and output. I would like to items with similiar output to produce:

Code:
Filename1.txt, Filename2.txt : Output
Filename3.txt: Output2

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

awk to combine all matching fields in input but only print line with largest value in specific field

In the below I am trying to use awk to match all the $13 values in input, which is tab-delimited, that are in $1 of gene which is just a single column of text. However only the line with the greatest $9 value in input needs to be printed. So in the example below all the MECP2 and LTBP1... (0 Replies)
Discussion started by: cmccabe
0 Replies

2. Shell Programming and Scripting

Multiple results as input to grep or awk

Hi: This is my first post in this forum. apologies if I am asking question that has been asked here multiple times. I wrote a python script that prints list of identifiers. I have another file notoriously big and with no particular format. I plan to search the identifiers in this file... (2 Replies)
Discussion started by: oriolebaltimore
2 Replies

3. Shell Programming and Scripting

Combine two lists From Multiple Grep commands.

I'm working with a file with an xml structure. I'd like to parse it down to just the bits i want. Here is and example of the file <message id="96352877" method="status"> <date rfc="Sat, 12 Mar 2011 16:13:15 -0600" unix="1299967995" /> <services> <service id="facebook"... (4 Replies)
Discussion started by: Erulisseuiin
4 Replies

4. UNIX for Dummies Questions & Answers

combine -A and -v in grep

I have a data file that looks like this: infile: A 13 Z 23 F 22 Z 413 R 16how do I combine the -A option with the -v option to get the lines that don't match 'Z' and their next lines? the outfile should be: A 13 F 22 R 16I tried: (1 Reply)
Discussion started by: jdhahbi
1 Replies

5. Shell Programming and Scripting

grep for certain files using a file as input to grep and then move

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

6. Shell Programming and Scripting

combine two grep statements

Hi I am wondering is it possible to combine two greps together I have two greps. grep "^,, *\." file (grep the line which has a '.' in the third column) grep "=" file (grep the line which has = anywhere) How to put them together so that if the content of the file that match either... (1 Reply)
Discussion started by: tiger66
1 Replies

7. Shell Programming and Scripting

Awk+Grep Input file needs to match a column and print the entire line

I'm having problems since few days ago, and i'm not able to make it works with a simple awk+grep script (or other way to do this). For example, i have a input file1.txt: cat inputfile1.txt 218299910417 1172051195 1172070231 1172073514 1183135117 1183135118 1183135119 1281440202 ... (3 Replies)
Discussion started by: poliver
3 Replies

8. Shell Programming and Scripting

grep this no. 0100025144 and combine

<CRMSUB:MSIN=0100025144,BSNBC=TELEPHON-9814072360-TS11&TS21&TS22,NDC=9814 <ENTROPRSERV:MSIN=0100025144,OPRSERV=UCSI,UCSI=771-919814047117&775-919814047117; <ENTRGCSERV:MSIN=0100025144,GCSERV=CALLWAIT-PROV&CALLHOLD&CLIP&HOTBILL&NATSS05,CLIPOVR=NO;... (3 Replies)
Discussion started by: dodasajan
3 Replies

9. Shell Programming and Scripting

sed, grep, cut or combine?

I am a beginner at shell scripting, actually i am working on my first script right now. Anyway i have searched the world how to grep two letters from each word (it will always just be two words). For example: Example Blablabla I want my script to cut out Ex (from the first word) and Bl... (4 Replies)
Discussion started by: maskot
4 Replies

10. UNIX for Dummies Questions & Answers

sed or grep or perl combine two lines

how do i search for the phrase "expected" on line one and "received" on line two. (there is a newline in between the two) I would like to know if/how this can be done in perl and/or grep and/or sed (3 Replies)
Discussion started by: artjaniger
3 Replies
Login or Register to Ask a Question