Shell Programming and Scripting

BSD, Linux, and UNIX shell scripting — Post awk, bash, csh, ksh, perl, php, python, sed, sh, shell scripts, and other shell scripting languages questions here.

Trying to use awk to check values and multiple

👤 Login to reply
Thread Tools Search this Thread Display Modes
Old 03-21-2018
ziggy6 ziggy6 is offline
Registered User
Join Date: Aug 2008
Last Activity: 21 March 2018, 2:30 PM EDT
Posts: 32
Thanks: 15
Thanked 0 Times in 0 Posts
That worked perfect rdrtx1. Can you tell me what to add to that so I can write the output to a file?
Sponsored Links
Old 03-21-2018
rdrtx1 rdrtx1 is offline Forum Advisor  
Registered Pusher
Join Date: Sep 2012
Last Activity: 31 May 2018, 9:41 AM EDT
Location: Houston, Texas, USA
Posts: 1,142
Thanks: 0
Thanked 421 Times in 398 Posts
See update to post #7
The Following User Says Thank You to rdrtx1 For This Useful Post:
ziggy6 (03-21-2018)
Sponsored Links
Old 03-21-2018
RudiC RudiC is offline Forum Staff  
Join Date: Jul 2012
Last Activity: 18 July 2018, 4:17 PM EDT
Location: Aachen, Germany
Posts: 13,073
Thanks: 449
Thanked 4,014 Times in 3,691 Posts
sed mayhap?
sed 's/\([0-9.]\+\)-/-\1/g' file

EDIT: Unfortunately,my mawk doesn't provide "back references", so the closest approximation would be
awk '{gsub (/[0-9.]+-/, "-&x"); gsub (/-x/, "")} 1' file

Last edited by RudiC; 03-21-2018 at 04:51 PM..
Sponsored Links
👤 Login to reply

« Previous Thread | Next Thread »
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Check multiple patterns in awk kannan13 Shell Programming and Scripting 3 10-14-2015 05:17 AM
How to get index values for multiple matches in the same line with awk? chilicuil Shell Programming and Scripting 6 07-14-2015 01:39 PM
Array in awk outputs multiple values alan Shell Programming and Scripting 1 11-09-2011 10:00 PM
Use AWK to check for numeric values? (BASH script) TauntaunHerder Shell Programming and Scripting 4 07-17-2011 02:10 PM
matching multiple values in awk VGR Shell Programming and Scripting 0 06-12-2009 11:37 AM

All times are GMT -4. The time now is 01:42 AM.

Unix & Linux Forums Content Copyright©1993-2018. All Rights Reserved.
Show Password

Not a Forum Member?
Forgot Password?