Tuesday, April 9, 2013

Count the occurrences of a string per line in a file


cat exampleFile
text 1 text
text text 4 text 56
2
4
test
345
87 text

Count the occurrences of 'text' in exampleFile per line
awk -F "text" '{print NF-1}' exampleFile
2
3
0
0
0
0
1

1 comment:

  1. Casino Nights - Hotel - JAMMYHUB
    Casino Nights is the only hotel-casino 경주 출장마사지 in the world 제주도 출장마사지 with great amenities, a VIP casino 순천 출장마사지 and a 안산 출장샵 VIP hotel. Located in the heart of Las Vegas, Casino Nights 밀양 출장샵 is

    ReplyDelete