Visit Our UNIX and Linux User Community

Search Results

Search: Posts Made By: sdf
2,072
Posted By sdf
It depends on what you want to select. If you...
It depends on what you want to select. If you want only those rows of file1 where field 1 is in file2 than use:

awk 'BEGIN{FS="|"}NR==FNR{a[$1]=$1;next}a[$1]' file2 file1 >selected_lines

If...
2,621
Posted By sdf
Are there several files and for every file the...
Are there several files and for every file the longest word shall be the measure for the field length?

---------- Post updated at 10:25 PM ---------- Previous update was at 04:42 PM ----------
...
1,531
Posted By sdf
Was already late for corona688:rolleyes: The...
Was already late for corona688:rolleyes:

The var's S1 and S2 need to change position

awk -v S1="ERROR" -v S2="PromotionsWebServiceClient" '($0 ~ S1) && ($0 ~ S2)' DATAFILE > OUTDATAFILE
1,493
Posted By sdf
awk 'BEGIN{OFS="\t"}{ for(N=1; N<=NF; N++) if($N...
awk 'BEGIN{OFS="\t"}{ for(N=1; N<=NF; N++) if($N == "01000000") $N="0" } 1'or even shorter if "01000000" is always on 3rd column
awk 'BEGIN{OFS="\t"}{ if($3 == "01000000") $3="0" } 1'
2,794
Posted By sdf
With this sample var=sprintf("%c", 0134); I got...
With this sample var=sprintf("%c", 0134); I got the idea to assign -v bs=\ Even this works as a FS for the split() command -v bs=[\._]

This finally worked best with DOS

gawk -v bs=\ "/...
Showing results 1 to 5 of 5

 

Featured Tech Videos

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