Hi,
I would like to know how can I get all the positions of a letter, let say letter C in a text file.
sample input file:
hcck
pgog
hlhhc
desired output file:
2
3
13
Many thanks!
Hi,
I would like to know how can I get all the positions of a letter, let say letter C in a text file.
sample input file:
hcck
pgog
hlhhc
desired output file:
2
3
13
Many thanks!
awk -vFS= -vj=0 '{
for(i=1;i<=NF;i++){
j++;
if($i~/[cC]/){
print j
}
}
}' file
Thanks for the fast reply. Since I am a UNIX newbie, can you write the full command?
Thanks again.
---------- Post updated at 11:48 AM ---------- Previous update was at 11:46 AM ----------
ok, nevermind. It worked perfectly. Many thanks!