Fedora Linux Support Community & Resources Center
  #1  
Old 1st November 2012, 09:03 PM
epperson Offline
Registered User
 
Join Date: Oct 2005
Location: Virginia
Posts: 64
linuxfirefox
awk command to change 1 field based on values of 2

This awk code outputs all fstab lines, prepending "nodev" to $4 (options) if $2 (mount point) matches "^/tmp$". But I want to add "nodev" only if it is not already in $4. How do I do that? I can't figure out how to add the second test.


Code:
awk -v FSYS="^/tmp$" -v FSOPT="nodev" -v FSOPTCOMMA="nodev," ' $2~FSYS{$4=FSOPTCOMMA$4}1' OFS="\t"   < /etc/fstab
Reply With Quote
Reply

Tags
awk, based, change, command, field, values

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
remove duplicate lines based on field and sort COKEDUDE Using Fedora 1 17th March 2012 03:34 PM
dpms values periodically change drewkenjo Using Fedora 6 16th February 2012 08:14 PM
how to Change the tag values of a rpm package pradiptart Programming & Packaging 0 30th January 2012 11:53 AM
Summing a list of values from the command line? doornail Using Fedora 4 13th December 2005 09:30 PM


Current GMT-time: 04:07 (Wednesday, 19-06-2013)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat