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 > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Query related to scp command sureshg_sampat Shell Programming and Scripting 2 12-03-2007 05:59 AM
sed related query gopsman Shell Programming and Scripting 1 11-30-2007 09:03 AM
Query related to for i in `cat $TEMP_DIR/country.txt sureshg_sampat Shell Programming and Scripting 1 08-31-2007 07:58 AM
Query related to #!/bin/sh sureshg_sampat Shell Programming and Scripting 2 02-08-2007 05:54 AM
Date change related query franklo UNIX for Dummies Questions & Answers 2 09-04-2002 09:41 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 05-22-2008
abhisek.says abhisek.says is offline
Registered User
  
 

Join Date: May 2008
Posts: 9
Question awk related query

hi,

I have to extract a column from a file and then updated that column..??

Now i can use wak for extracting it and then how to update it..

$ awk' {print $5}' input_file

Can i use sed command here piping it to the output from the awk command..
  #2 (permalink)  
Old 05-22-2008
penchal_boddu penchal_boddu is offline
Registered User
  
 

Join Date: Apr 2008
Location: Bangalore
Posts: 127
Hi

U can do like

awk '{ $5="test remaing part...}' filename

when u change a field value awk recomputes the whole $0 again and thus updates ur values

Thanks
Penchal
  #3 (permalink)  
Old 05-22-2008
vguleria vguleria is offline
Registered User
  
 

Join Date: Mar 2008
Location: India(Sarkaghat)
Posts: 28
Hi,

Use '~' to match the values,
The one liner will be:

awk '{if($5~"Hi") $5="bye"; print}' input_file


Regards,
Vinod.
Sponsored Links
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 04:03 AM.


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