Search Results

Search: Posts Made By: Sam R
1,848
Posted By Yoda
$ awk '/[0-9][A-F]/&&!/:/{sub("-->",X);printf...
$ awk '/[0-9][A-F]/&&!/:/{sub("-->",X);printf $1"-"$2";"}END{printf "\n"}' file
0AFC-51201;0AFD-17263;0AFE-51201;
1,848
Posted By MadeInGermany
sed can handle it but has no output formatting. ...
sed can handle it but has no output formatting.
With sed and tr
sed -n 's/^[- >]\{5,\} \([0-9A-F]\{4\}\) *\([0-9][0-9]*\) .*/\1-\2/p' file |
tr '\n' ';'awk has output formatting, and an RE or...
1,848
Posted By Yoda
You could simplify it to: awk...
You could simplify it to:
awk '/[0-9][A-F]/{sub("-->",X);s=s?s";"$1"-"$2:$1"-"$2}END{print s}' file
OR
awk '/[0-9][A-F]/{sub("-->",X);printf $1"-"$2";"}END{printf "\n"}' file
2,044
Posted By MadeInGermany
Here is another one with awk: awk ' ...
Here is another one with awk:

awk '
NR==FNR {obj[$1$2]=1; fn=FILENAME; next}
/^List/ {
if(s!="") printf "%s has %d objects from %s\n",s,cnt,fn
s=$0; cnt=0
next
}
$1$2 in obj {cnt++}
END {...
2,044
Posted By ahamed101
Is this how the actual data looks like? with...
Is this how the actual data looks like? with space and tab and all? Cause it will matter while coding. A real data sample would help us better.

--ahamed
2,044
Posted By Yoda
Here is an awk program that might work for the...
Here is an awk program that might work for the posted sample input:
awk ' BEGIN {
F = "file1"
while ( (getline line < F) > 0 )
{
gsub(/^[ \t]*|[ \t]*$/,...
Showing results 1 to 6 of 6

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