Help answer threads with 0 replies.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
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.


  Search this Thread
Old 05-13-2004, 10:28 PM   #1
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
LQ Newbie
Registered: May 2004
Posts: 12

Rep: Reputation: 0
Try this:

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


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 > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:51 AM.

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