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
Awking anduzzi Shell Programming and Scripting 3 02-09-2009 01:37 PM
awking and grepping parts of files: the 'super diff' jeffpas Shell Programming and Scripting 11 07-17-2008 06:54 PM
Awking!! Printing decimal output is struck divzz Shell Programming and Scripting 4 05-28-2008 08:02 AM

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 02-24-2009
anduzzi anduzzi is offline
Registered User
  
 

Join Date: Aug 2008
Posts: 48
Help with awking

Hi...
How does awk or sed or even grep extract the following string out of my text file?.
'"${ETL_VW_SCHEMA}"'.IATA_STN_TZ_UTC_LCL_CONV_CV
'"${ETL_VW_SCHEMA}"'.CO
'"${ETL_VW_SCHEMA}"'.TEST_CO

I just need to extract the second entry which means I need to let awk know I am just searching for CO and not any combinations(like TEST_CO and IATA_STN_TZ_UTC_LCL_CONV_CV) and with the occurence of ETL_VW_SCHEMA...so, basically I need to search for '"${ETL_VW_SCHEMA}"'.CO
For some reason my awk doesn't recognize the period(.) in my search pattern.

Thx !
  #2 (permalink)  
Old 02-24-2009
vgersh99's Avatar
vgersh99 vgersh99 is online now Forum Staff  
Moderator
  
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 5,121
Code:
$ nawk '/'"${ETL_VW_SCHEMA}"'.TEST_CO/' myFile.txt
'"${ETL_VW_SCHEMA}"'.TEST_CO
$ egrep ''"${ETL_VW_SCHEMA}"'.TEST_CO' myFile.txt
'"${ETL_VW_SCHEMA}"'.TEST_CO
  #3 (permalink)  
Old 02-24-2009
anduzzi anduzzi is offline
Registered User
  
 

Join Date: Aug 2008
Posts: 48
Thanks for the reply !
I am on Solaris and these commands quite not working as expected.

Code:
bash-2.03$ egrep ''"${ETL_VW_SCHEMA}"'.CO' my.dat
'"${ETL_VW_SCHEMA}"'.IATA_STN_TZ_UTC_LCL_CONV_CV
'"${ETL_VW_SCHEMA}"'.CO
'"${ETL_VW_SCHEMA}"'.TEST_CO
Code:
bash-2.03$ nawk '/'"${ETL_VW_SCHEMA}"'.CO/' my.dat
'"${ETL_VW_SCHEMA}"'.IATA_STN_TZ_UTC_LCL_CONV_CV
'"${ETL_VW_SCHEMA}"'.CO
'"${ETL_VW_SCHEMA}"'.TEST_CO
I get all the occurences !
  #4 (permalink)  
Old 02-24-2009
anduzzi anduzzi is offline
Registered User
  
 

Join Date: Aug 2008
Posts: 48
Escaping the period works.

Code:
awk '/\.\CO/' my.dat
'"${ETL_VW_SCHEMA}"'.CO
  #5 (permalink)  
Old 02-24-2009
vgersh99's Avatar
vgersh99 vgersh99 is online now Forum Staff  
Moderator
  
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 5,121
you probably want this:
Code:
awk '/[.]CO$/' my.dat
'"${ETL_VW_SCHEMA}"'.CO
  #6 (permalink)  
Old 02-24-2009
anduzzi anduzzi is offline
Registered User
  
 

Join Date: Aug 2008
Posts: 48
Thx this works !
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 06:43 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