Search Results

Search: Posts Made By: ynneycat
2,974
Posted By ynneycat
It works! Wow that's brilliant. Thank you so...
It works! Wow that's brilliant.
Thank you so much for the help and for rekindling esteem for the awesome awk.

The final version for anyone who wants to know:

awk -F '[,:]' '{ for ( i=6; i <=...
2,974
Posted By ynneycat
Nearly! It was having problems with the six...
Nearly!
It was having problems with the six trailing ,,,,,, so I have stripped these out with sed first.

But it is still is skipping the first subject. I think this is because of the delimiter....
2,974
Posted By ynneycat
Sorry. No good. awk -F '[,:]' '{ for ( i=7,...
Sorry. No good.

awk -F '[,:]' '{ for ( i=7, i <= NF i++) { printf "%s,%s,%s\n", $1, $2, $i } }'


The error message is:
awk: syntax error at source line 1
context is
{ for ( >>> ...
2,974
Posted By ynneycat
Hi Anbu Thanks for this lovely looking awk...
Hi Anbu
Thanks for this lovely looking awk array
awk -F"," ' {
str=$1
for( i = 2 ; i <= NF - 7 ; ++i )
str=str "," $i
n=split($(NF-6),arr,":")
for( i = 1 ; i <= n ; ++i )
print str ","...
2,974
Posted By ynneycat
Thanks - Yes, probably should have been really...
Thanks - Yes, probably should have been really specific
The file I'm working with will have hundreds of lines. The first few lines basically like this (incl headers)


The end of each line always...
2,974
Posted By ynneycat
Wow! This rocks. That seems to work....
Wow! This rocks.
That seems to work. Unbelievable.

The actual file may have anywhere from 1 to 10 or more colon separated subjects per user. Do you think it will still work Ok?

I guess I'm...
2,974
Posted By ynneycat
formatting a file headache
Hello does anyone know how to do the following using some simple unix if possible:

I have a file with the following info as comma separated. It shows username, id number and all the subjects they...
Showing results 1 to 7 of 7

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