Grep/print/ a test file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Grep/print/ a test file
# 15  
Old 05-19-2015
Quote:
Originally Posted by RudiC
Hey Don, where's your usual line?

If you are using a Solaris/SunOS system, use /usr/xpg4/bin/awk or nawk instead of awk . (Don Cragun)
I got this thread confused with a different thread where the OS was specified to be a Linux distribution. This thread doesn't specify the OS, so I should have included the warning line.

- Don
# 16  
Old 05-19-2015
Try /usr/xpg4/bin/awk instead of nawk.
# 17  
Old 05-19-2015
Code:
/usr/xpg4/bin/awk 'BEGIN{RS=""; OFS="|"} {print $2, $21, $15}' abc.txt

Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Grep file and print value only if the following line doesnt contain value xxxx

Hi All, I have some large files which I would like to obtain some data from, I want to grep (or alturnative method) out certain values hut only if the folowing line doesnt contain a certain value. I will explain better below showing an example print of the data. NE : V0001 NE : V0002... (6 Replies)
Discussion started by: mutley2202
6 Replies

2. Shell Programming and Scripting

Grep in file and print in the line

hi # cat test.txt Test Date: 20131008 1515 -------------------------------------------------------------------------------------------------------------- Saxx = Proc_m0_s13 : 1640 Saxx = Proc_m0_s15 : 1791 Saxx = Proc_m0_s17 ... (2 Replies)
Discussion started by: justbow
2 Replies

3. Shell Programming and Scripting

Grep or print each section of a file on one line with a separator

I can obtain information from itdt inventory command however it display as below, I'd like to print each entity on one line but seperated by : the file is something like and each section ends with Volume Tag Drive Address 256 Drive State ................... Normal ASC/ASCQ... (3 Replies)
Discussion started by: gefa
3 Replies

4. Shell Programming and Scripting

Script to process file from a directory and grep the required content and print

Hi All, below script reads the perticular files from the directory. Am trying to fetch status and print them in the required format. It needs to read line and search for string "Passed/Failed" and print them under correct sub header. script : BASE_DIR=/tmp/test/REPORT/CollectReport #... (16 Replies)
Discussion started by: Optimus81
16 Replies

5. UNIX for Dummies Questions & Answers

Print file name when running grep from within find

Solaris 10 When running grep from within find command (don't know the technical term for 'running from within' ) , find command returns only the line which contains the pattern. Is there any way to get the file name printed as well ? $ pwd /opt/testdir/anotherDir $ $ $ cat findme.txt... (3 Replies)
Discussion started by: omega3
3 Replies

6. Shell Programming and Scripting

grep/awk to only print lines with two columns in a file

Hey, Need some help for command to print only lines with two columns in a file abc 111 cde 222 fgh ijk 2 klm 12 23 nop want the ouput to be abc 111 cde 222 ijk 2 Thanks a lot in advance!!! (3 Replies)
Discussion started by: leo.maveriick
3 Replies

7. Shell Programming and Scripting

find file and print only contents with a hit by grep

Hi, can someone help me. I have some files and search a content in this files. If i have a hit I will print a output: filename:content But are more hits in one file: The output is always filename:content E.G. Seach about "three" file1 {one, two, three, four, three} file2... (5 Replies)
Discussion started by: Timmää
5 Replies

8. 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

9. UNIX for Dummies Questions & Answers

find file grep it and print file name

i am trying to search a few hundred release note text files for a certain word. however when i use the below command i can find a file that contains it but i dont know the file name. how can i change this command to output the name of the file that grep was successful in? find builds -name... (4 Replies)
Discussion started by: borderblaster
4 Replies
Login or Register to Ask a Question