punticci
June 3rd, 2013, 08:56 AM
Hi, is there a way to read the fields between the field separator? I mean, for example, i have a file structured in this way:
#@;field1#@;field2#@;field3#@;field4#@;field5#@;fi eld6
ok, now i want to make something like this :
temp=${ENDROW##*#@;} field1=`printf '"%s"\n' "${temp%%#@;*}"
where ENDROW is because i made a while condition before:
ENDROW=""
while read ENDROW;
do
temp=${ENDROW##*#@;} field1=`printf '"%s"\n' "${temp%%#@;*}"
So i have to read the first field and find that between the first #@; and the second #@; there is the filed1 and go on in this way. The solution i posted doesn't go and the fields are empty :( any suggestion?Thanks
#@;field1#@;field2#@;field3#@;field4#@;field5#@;fi eld6
ok, now i want to make something like this :
temp=${ENDROW##*#@;} field1=`printf '"%s"\n' "${temp%%#@;*}"
where ENDROW is because i made a while condition before:
ENDROW=""
while read ENDROW;
do
temp=${ENDROW##*#@;} field1=`printf '"%s"\n' "${temp%%#@;*}"
So i have to read the first field and find that between the first #@; and the second #@; there is the filed1 and go on in this way. The solution i posted doesn't go and the fields are empty :( any suggestion?Thanks