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
case command inside awk/nawk abdulaziz Shell Programming and Scripting 9 03-09-2009 09:15 PM
need clarification about tr -d command ? vparunkumar Shell Programming and Scripting 7 03-18-2008 11:08 AM
Sun Unix command clarification FredSmith SUN Solaris 4 07-12-2007 02:30 AM
if within nawk command kshelluser UNIX for Dummies Questions & Answers 1 11-30-2006 07:02 AM
nawk command not found 12yearold Shell Programming and Scripting 5 07-07-2006 03:40 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 07-28-2005
Tux_Raju Tux_Raju is offline
Registered User
  
 

Join Date: May 2005
Posts: 7
nawk command clarification

Hi,

I am using the following command.

nawk '$1==p{$2=sprintf("%09d",$2+1)};1' p=$JOB_NUM q=$LEN $VALUE_TABLE > ./TEMP_TABLE

As you can see the code above, I basically read a value from the table VALUE_TABLE and select a particular row based on searching the value JOB_NUM. Now Actually the string i am incrementing ie, $2 is of 9 characters. So here i am populating that value 09 here. But i want to send this value as a variable here. ie i will place the value 9 in the table and i want to read it from there.

Please help me out in this, as to how to modify this code.
  #2 (permalink)  
Old 07-28-2005
vgersh99's Avatar
vgersh99 vgersh99 is offline Forum Staff  
Moderator
  
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 5,122
not sure if that's what wanted...
Code:
 nawk '$1==p{$2=sprintf("%0" w "d",$2+1)};1' p=$JOB_NUM q=$LEN $VALUE_TABLE w=9> ./TEMP_TABLE
  #3 (permalink)  
Old 07-28-2005
Tux_Raju Tux_Raju is offline
Registered User
  
 

Join Date: May 2005
Posts: 7
Thanks

Thanks mate that a was cool one... Thanks alot.. Yes it was to my requirement. Had to struggle around for that syntax actually.....
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 09:06 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