The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How to extract row in a new file ahjiefreak Shell Programming and Scripting 1 12-17-2007 12:08 AM
extract one file form .tar.gz without uncompressing .tar.gz file balireddy_77 Shell Programming and Scripting 2 07-10-2007 05:23 AM
extract content from a file and insert to another file fredao Shell Programming and Scripting 15 12-06-2006 07:36 PM
SD-UX, PSF-File extract (HP-UX) adme UNIX for Advanced & Expert Users 1 09-17-2002 11:34 AM
extract only file name from full path file name sanjay92 UNIX for Dummies Questions & Answers 2 10-02-2001 09:49 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 05-08-2002
odogbolu98 odogbolu98 is offline
Registered User
  
 

Join Date: Jan 2002
Location: Minnesota
Posts: 32
Question Extract from a file

Hi guys,

Thanks for this forum. It's been very helpful in improving my understanding of unix.

I have 2 questions.

a. eg I have the following

big_tom_get_back("final") in a file, how can I use awk or sed to xtract the word "final" without the quote from the string.

I try using cat tempfile|grep big_tom_get |awk `/\(\" $1 \"\)

This doesn't seem to work.

b. The second question is that I want to use the same command to loop through all the temp files stored in different location/directory. How can I do that? Does the find commnd work here?

I would appreciate any assistance on this

Thanks,

Odogbolu98
  #2 (permalink)  
Old 05-08-2002
thehoghunter
Guest
  
 

Posts: n/a
Bits: 0 [Banking]
Read the man page on awk and you will find the -F option - use it to change the field separator - set it to " and print $2 should give you what you want.

Read the man page on find - check out the exec option.
  #3 (permalink)  
Old 05-08-2002
odogbolu98 odogbolu98 is offline
Registered User
  
 

Join Date: Jan 2002
Location: Minnesota
Posts: 32
Can I have an example of that. It seems to me that " can't be used as a delimiter. what I mean is
eg. -F"\t" represents tab as a delimiter, when I use -F"\"" it gives unmatched ". message. Am I doing something wrong?


Thanks
  #4 (permalink)  
Old 05-09-2002
thehoghunter
Guest
  
 

Posts: n/a
Bits: 0 [Banking]
Example (done in csh - should work with minor changes in other shells)

set junk='big_tom_get_back("final")'
echo $junk|awk -F\" '{print $2}'
final
  #5 (permalink)  
Old 05-10-2002
odogbolu98 odogbolu98 is offline
Registered User
  
 

Join Date: Jan 2002
Location: Minnesota
Posts: 32
Thanks, I really appreciate your help.


Regards,

Odogbolu98
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 01:00 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0