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

    #8  
Old 03-21-2018
ziggy6 ziggy6 is offline
Registered User
 
That worked perfect rdrtx1. Can you tell me what to add to that so I can write the output to a file?
Sponsored Links
    #9  
Old 03-21-2018
rdrtx1 rdrtx1 is offline Forum Advisor  
Registered Pusher
 
See update to post #7
The Following User Says Thank You to rdrtx1 For This Useful Post:
ziggy6 (03-21-2018)
Sponsored Links
    #10  
Old 03-21-2018
RudiC RudiC is offline Forum Staff  
Moderator
 
sed mayhap?
Code:
sed 's/\([0-9.]\+\)-/-\1/g' file

EDIT: Unfortunately,my mawk doesn't provide "back references", so the closest approximation would be
Code:
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

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 08:56 AM.

Unix & Linux Forums Content Copyright©1993-2018. All Rights Reserved.
×
UNIX.COM Login
Username:
Password:  
Show Password





Not a Forum Member?
Forgot Password?