Unix/Linux Go Back    


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

Shell Programming and Scripting


Reply    
 
Thread Tools Search this Thread Display Modes
    #8  
Old Unix and Linux 4 Weeks Ago   -   Original Discussion by ziggy6
ziggy6's Unix or Linux Image
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
    #9  
Old Unix and Linux 4 Weeks Ago   -   Original Discussion by ziggy6
rdrtx1's Unix or Linux Image
rdrtx1 rdrtx1 is offline Forum Advisor  
Registered Pusher
 
Join Date: Sep 2012
Last Activity: 20 April 2018, 10:12 PM EDT
Location: Houston, Texas, USA
Posts: 1,110
Thanks: 0
Thanked 405 Times in 383 Posts
See update to post #7
The Following User Says Thank You to rdrtx1 For This Useful Post:
ziggy6 (4 Weeks Ago)
Sponsored Links
    #10  
Old Unix and Linux 4 Weeks Ago   -   Original Discussion by ziggy6
RudiC's Unix or Linux Image
RudiC RudiC is offline Forum Staff  
Moderator
 
Join Date: Jul 2012
Last Activity: 21 April 2018, 11:23 AM EDT
Location: Aachen, Germany
Posts: 12,504
Thanks: 401
Thanked 3,877 Times in 3,564 Posts
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; 4 Weeks Ago at 04:51 PM..
Sponsored Links
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux 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 11:40 AM.