Print Pattern from file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Print Pattern from file
# 1  
Old 05-13-2013
Print Pattern from file

Code:
cat file | awk '{printf"(t.who = "'"%s",$1}'

Regards
ADI

Last edited by adisky123; 05-14-2013 at 03:37 AM..
# 2  
Old 05-13-2013
Code:
awk '{print "(t.who = \x27" $1 "\x27 and trunc(ymddate) = to_date(\x27" $7"-"$8"-"$NF"\x27,\x27mon-dd-yyyy\x27)) or"}' file

This User Gave Thanks to Yoda For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

sed -- Find pattern -- print remainder -- plus lines up to pattern -- Minus pattern

The intended result should be : PDF converters 'empty line' gpdftext and pdftotext?xml version="1.0"?> xml:space="preserve"><note-content version="0.1" xmlns:/tomboy/link" xmlns:size="http://beatniksoftware.com/tomboy/size">PDF converters gpdftext and pdftotext</note-content>... (9 Replies)
Discussion started by: Klasform
9 Replies

2. Shell Programming and Scripting

How to print the lines between two pattern in a file?

file like: services: XXXXXXXX: XXXXXXX: XXXXXXXXX1 XXXXX XXXXXXXXX DDDDDDDDDDD BBBBB: version: 11.2.0.4 services: YYYYYYYYYY XXXXXXXXXX: XXXXXXXXX XXXXXXXX XXXXXXXXX... (5 Replies)
Discussion started by: netbanker
5 Replies

3. Shell Programming and Scripting

Want to print out lines with a matching pattern from file

Hi all, I want to search for strings in file1 that can be found in file2 and print out the whole line when matching pattern is found. I have used the below command, but this is not working for me, because it is writing out only the matching patterns from file2, not the whole line. fgrep -o... (2 Replies)
Discussion started by: MonikaB
2 Replies

4. Shell Programming and Scripting

Find pattern in file and print

Hello, I want to read a CSV file and look for a pattern on each line. If the pattern is found I want to read another portion/column of that line and print that. Can somebody help me in writing it in CSH? E.g. CSV file has following lines, 1,Elephant,500kg,,,,, 2,Tiger,50kg,,,,,... (4 Replies)
Discussion started by: deshiashish
4 Replies

5. Shell Programming and Scripting

Print pattern range to a new file

Hi Everyone! I really appreciate all of your help, I'm learning so much, can't wait until I get good enough to start answering questions! I have a problem ... from one large file, I'd like to create multiple new files for each pattern block beginning with /^ISA/ ending with /^IEA/ ... (2 Replies)
Discussion started by: verge
2 Replies

6. Shell Programming and Scripting

Awk/Sed: Search Pattern from file and Print

Hi, I want to search for patterns (from a file) in a file and print the line matching the patterns and the line before it. I have to search for 100s of patterns from a file. Any help with AWK or Sed. Thanks! (2 Replies)
Discussion started by: saint2006
2 Replies

7. UNIX for Dummies Questions & Answers

Print a pattern from a file

Hi :), Pls help me in solving a problem. I have a file containing several lines as shown below: BS30_CFNRC='P';BS30_BAOC='P';BS30_BOIC='P';BS30_BAIC='P'; BS30_BICRO='P';BS30_CAW='P';Loc_Code='VLR known';VLR_address='919457499995';Nbr_indicator='MSC';MSC_MSRN_Nbr='919457499995'; There is no... (2 Replies)
Discussion started by: vanand420
2 Replies

8. Shell Programming and Scripting

Pattern matching in Duplicated file and print once

Dear Experts, I have many alarms appeared in a file twice, i want to grep them with this info EVTTIME & DOMAIN, and print them in second file with 1 occurance. I have tried uniq -d test.txt > newfile and awk '!arr++' test.txt > newfile both are not working Please help me with this!!! ... (1 Reply)
Discussion started by: Danish Shakil
1 Replies

9. Shell Programming and Scripting

Sed to delete exactly match pattern and print them in other file

Hi there, I need help about using sed. Iam using sed to delete and print lines that match the port number as listed in sedfile. I am using -d and -p command for delete match port and print them respectively. However, the output is not synchonize where the total deleted lines is not similar with... (3 Replies)
Discussion started by: new_buddy
3 Replies

10. Shell Programming and Scripting

searching pattern in another file and print

Suppose u have a file 12 22 73 another file L22D SSS S12J LLL H77K PPP J25O LOP I73S lOP K99O PLO so output shud like S12J LLL L22D SSS I73S lOP Thanks (2 Replies)
Discussion started by: cdfd123
2 Replies
Login or Register to Ask a Question