Search Results

Search: Posts Made By: Joselouis
1,957
Posted By durden_tyler
Alternatively, in Perl, you could combine the...
Alternatively, in Perl, you could combine the beginning of line with a character class containing all the characters that could precede the redundant zero, like so:


$
$ perl -lne 's/(^|[...
1,957
Posted By MadeInGermany
Many sed versions have a "word boundary" anchor. ...
Many sed versions have a "word boundary" anchor.
sed 's/\<0//g'Multiple leading zero's:
sed 's/\<0*\([0-9]\)/\1/g'or
1,957
Posted By Don Cragun
awk '{ sub(/^0/, "") gsub(/ 0/, " ") ...
awk '{ sub(/^0/, "")
gsub(/ 0/, " ")
gsub(/[|]0/, "|")
gsub("/0", "/")
gsub(":0", ":")
}
1' file
and with a POSIX conforming version of sed:
sed -e 's/^0//' -e 's,\([|/: ]\)0,\1,g' file
...
843
Posted By RudiC
No awk needed: while IFS=\| read V1 V2 V3 V4...
No awk needed:
while IFS=\| read V1 V2 V3 V4 REST; do [ ! "$V4" = "UPSTR" ] && continue; echo $V1, $V2, $V3; done < file
NOTE1, VALUE1, HMM
NOTE2, , HMP
NOTE3, VALUE3, HML
NOTE4, , HMD
NOTE5,...
1,461
Posted By RavinderSingh13
Hello Joselouis, If you want to do a check...
Hello Joselouis,

If you want to do a check on a variable's value either it is NULL or not then -z checks if a variable is empty if block's value will be TRUE so either you could use your awk into...
1,444
Posted By RavinderSingh13
Hello Joselouis, Could you please try...
Hello Joselouis,

Could you please try following and let me know if this helps you.

awk -vvar="$VAR" 'NR==1{print $0 var;next} 1' Input_file

Output will be as follows.

12-11-16|11 2016...
Showing results 1 to 6 of 6

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