Search Results

Search: Posts Made By: fuad_
1,199
Posted By fuad_
cat filename | awk -F '-' '{$NF=""; $(NF-1)="";...
cat filename | awk -F '-' '{$NF=""; $(NF-1)=""; print }' | sed 's/ /-/g' | sed 's/--$//g'

Please next time seperate input and expected output in two different CODEQOUTE
1,199
Posted By fuad_
cat filename | awk -F '-' '{$NF=""; $(NF-1)="";...
cat filename | awk -F '-' '{$NF=""; $(NF-1)=""; print }' | sed 's/ /-/g' | sed 's/--$//g'

Please next time seperate input and expected output in two different CODEQOUTE
1,835
Posted By fuad_
You can just add sed 's/ /\t/g' to the end to...
You can just add sed 's/ /\t/g' to the end to replace the space to tab or you can edit the original code to be like this:

cat test | tr '\n' '\t' | awk ' { for (i=1; i<=NF/2; i++) { print $i,...
1,835
Posted By fuad_
I checked it and I find a small bug and here how...
I checked it and I find a small bug and here how I fix my first solution

cat filename | tr '\n' '\t' | awk ' { for (i=1; i<=NF/2; i++) { print $i, $(i+(NF/2)), "\n" } }'

$ cat test
A
01
02...
1,835
Posted By fuad_
cat filename | tr '\n' '\t' | awk ' { for (i=1;...
cat filename | tr '\n' '\t' | awk ' { for (i=1; i<=NF/2; i++) { print $i, $(i+(NF/2)), "\n" } }'



Solution edited and fixed
12,554
Posted By fuad_
Count number of occurrence at each line
Hi

I have the following file
ENST001 ENST002 4 4 4 88 9 9
ENST004 3 3 3 99 8 8
ENST009 ENST010 ENST006 8 8 8 77 8 8

Basically I want to count how many times ENST* is repeated in each line...
Showing results 1 to 6 of 6

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