awk search for Quoted strings (')


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting awk search for Quoted strings (')
# 8  
Old 07-10-2007
I have one more query, how do we identify if the strings with quotations pass on to the next line.

Thanks.
# 9  
Old 07-10-2007
Try the following awk command :
Code:
awk -v RS="'" 'NR%2==0 {print "string=" RS $0 RS}' input_file

Jean-Pierre.
# 10  
Old 07-10-2007
The above command worked,
can u please suggest me a book for shell scripting.

If possible give me a link to download that too

Thanks.
# 11  
Old 07-10-2007
Kprattip,
This is a non-commercial site, thus there cannot be book recommendation.
If you are a beginner, any shell script book will help you.

To continue learning, keep watching the solutions in this site and when
you feel comfortable, read the problem and try to solve it by yourself, then
compare your solution with the solution presented here.

Good luck!
# 12  
Old 07-10-2007
dude, even though non-commercial site, its not harm in suggesting...
# 13  
Old 07-10-2007
Quote:
Originally Posted by kprattip
dude, even though non-commercial site, its not harm in suggesting...
'dude',
if you browse the FAQs - you might find it useful.
# 14  
Old 07-10-2007
Hi.

I like books and often recommend them. In looking over the rules, I see:
Quote:
(C) Remember, this is a non-commerical [sic] forum dedicated to the open and universal exchange of information. Please help keep the quality of the posts very high for the entire world community.
which does not seem to prohibit suggestions, but rather seems to encourage them -- open and universal exchange -- does it not?

It is one thing to attempt to market a product that is not solicited, but it is quite another to reply to a request for information.

As for the FAQs, unless I looked in the wrong place, the last post in UNIX books was 2001. Classics certainly exist, but if we lived by 2001 technology in *nix, we'd be far worse off. We might not even be able to maintain our boxes if we didn't have access to new information ... cheers, drl
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

awk? extract quoted "" strings from multiple lines.

I am trying to extract multiple strings from snmp-mib files like below. ----- $ cat IF-MIB.mib <snip> linkDown NOTIFICATION-TYPE OBJECTS { ifIndex, ifAdminStatus, ifOperStatus } STATUS current DESCRIPTION "A linkDown trap signifies that the SNMP entity, acting in... (5 Replies)
Discussion started by: genzo
5 Replies

2. Shell Programming and Scripting

awk strings search + print next column after match

Hi, I have a file filled with search strings which have a blank in between and look like this: S. g. Ehr. o. Jg. v. d. Chijs g. Ehr. Now i would like to search for the strings and it also shall return the next column after the match. awk -v FILE="search_strings.txt" 'BEGIN {... (10 Replies)
Discussion started by: sdf
10 Replies

3. Shell Programming and Scripting

awk to search similar strings and add their values

Hi, I have a text file with the following content: monday,20 tuesday,10 wednesday,29 monday,10 friday,12 wednesday,14 monday,15 thursday,34 i want the following output: monday,45 tuesday,10 wednesday,43 friday,12 (3 Replies)
Discussion started by: prashu_g
3 Replies

4. Shell Programming and Scripting

awk search an output string between two strings

I would like to search for strings stored in searchstringfile.txt in inputfiles. searchstringfile.txt J./F. Gls. Wal F. Towerinput1.txt What is needed is J./F. 12 var Gls. Wal 16 interp. Tower 12 input2.txt Awk shall search for F. 16 pt. J./F. 22 output.txt input1.txt J./F. = 12 var... (3 Replies)
Discussion started by: sdf
3 Replies

5. Shell Programming and Scripting

awk search strings from array in textfile

I am wanting to take a list of strings and loop through a list of textfiles to find matches. Preferably with awk and parsing the search strings into an array. // Search_strings.txt tag string dummy stuff things // List of files to search in textfile1.txt textfile2.txt The... (6 Replies)
Discussion started by: sdf
6 Replies

6. Shell Programming and Scripting

awk how to search strings within a file from two different lines

Hi, i would really appreciate any help anyone can give with the following info. Thanks in advance. I need to run a search on a file that contains thousands of trades, each trade is added into the file in blocks of 25 lines. i know the search has to take place between a time stamp specified... (4 Replies)
Discussion started by: sp3arsy
4 Replies

7. Shell Programming and Scripting

Using Awk to Search Two Strings on One Line

If i wanted to search for two strings that are on lines in the log, how do I do it? The following code searches for just one string that is one one line. awk '/^/ {split($2,s,",");a=$1 FS s} /failure agaf@fafa/ {b=a} END{print b}' urfile What if I wanted to search for "failure agaf@fafa"... (3 Replies)
Discussion started by: SkySmart
3 Replies

8. Shell Programming and Scripting

Awk search for a element in the list of strings

Hi, how do I match a particular element in a list and replace it with blank? awk 'sub///' $FILE list="AL, AK, AZ, AR, CA, CO, CT, DE, FL, GA, HI, ID, IL, IN, IA, KS, KY, LA, ME, MD, MA, MI, MN, MS, MO, MT, NE, NV, NH, NJ, NM, NY, NC, ND, OH, OK, OR, PA, RI, SC, SD, TN, TX, UT, VT, VA, WA,... (2 Replies)
Discussion started by: grossgermany
2 Replies

9. Shell Programming and Scripting

Varying number of awk search strings

I've created an awk script that handles a varying number of search strings handed to it as command line parameters ($1 $2 etc). There may be 1, or 2 or 3 or more. A simplified version of the script is: awk -v TYP="$1 $2 $3 $4 $5 $6" ' BEGIN { CTYP = split (TYP,TYPP," ") } ... (2 Replies)
Discussion started by: CarlosNC
2 Replies

10. Shell Programming and Scripting

odd behaviour with quoted input strings

I'm working with a java-based monitoring tool (Solaris/x86) which can be configured to call a shell script when a particular event occurs. The java app sends a set of quoted strings as input to the shell script. The problem I'm running into is that the shell script, when called by the java app,... (0 Replies)
Discussion started by: iron_horse
0 Replies
Login or Register to Ask a Question