LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices



Reply
 
Search this Thread
Old 05-13-2004, 10:28 PM   #1
pantera
Member
 
Registered: May 2004
Posts: 80

Rep: Reputation: 15
Question searching with awk


how to find and modify nth field in nth line(example: 5th field in line 5) of a file using awk?
 
Old 05-14-2004, 07:57 AM   #2
Ma3oiS
LQ Newbie
 
Registered: May 2004
Posts: 12

Rep: Reputation: 0
Try this:

Code:
n=1    # requested row & field
awk 'NR=='$n' { $'$n'="your new value" }
{ print }' inputfile > outputfile
Ma3oiS
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
About awk script sachin_keluskar Linux - Software 2 06-24-2005 04:19 AM
awk question denalitastic Linux - Newbie 1 06-07-2005 11:42 AM
awk newbie eremit Programming 2 03-27-2005 08:08 AM
using awk wedgeworth Linux - Newbie 9 02-20-2004 08:48 AM
awk problem jpostma Programming 7 10-22-2003 07:07 AM


All times are GMT -5. The time now is 08:54 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration