Search Results

Search: Posts Made By: sekfarok
15,071
Posted By wisecracker
OSX 10.12.2, default bash terminal followed by...
OSX 10.12.2, default bash terminal followed by dash, longhand.
Last login: Tue Jan 10 20:16:48 on ttys000
AMIGA:amiga~> var='00000-123'
AMIGA:amiga~> echo $(($var))
-123
AMIGA:amiga~> dash...
15,071
Posted By vgersh99
a bit convoluted, but doesn't rely on the...
a bit convoluted, but doesn't rely on the fixed-width and/or hardwired column width values, but:

awk -F'T0+[1-6]+0' '/^T/{print (($2~/-/)?substr($2,index($2,"-")+1):$2+0)}' myFile
You can change...
15,071
Posted By Don Cragun
It isn't really clear to me what you're trying to...
It isn't really clear to me what you're trying to do in cases where there is no <hyphen> character in your output from awk. Is a return value like 000000234 to remain unchanged or do you want to...
15,071
Posted By RudiC
Try awk '{X = substr ($1,7,9); sub (/^0+/, "",...
Try
awk '{X = substr ($1,7,9); sub (/^0+/, "", X); print X}' file
234
-123
234
234
-11234
234
234
15,071
Posted By RavinderSingh13
Hello sekfarok, Still 100% not sure, could...
Hello sekfarok,

Still 100% not sure, could you please try following.

awk '/^T/ && /-/{split($0, A,"-");print "-"A[2]}' Input_file
or
awk '/^T/ && /-/{sub(/.*-/,"-");print}' Input_file
...
Showing results 1 to 5 of 5

 
All times are GMT -4. The time now is 09:09 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy