Using Grep To Search files & Counting Frequency For Words With Grep On Linux

View previous topic View next topic Go down

Using Grep To Search files & Counting Frequency For Words With Grep On Linux

Post by jamied_uk on 22nd July 2016, 00:03

Using Grep To Search files


Code:
#!/bin/bash
# grep -riI "introduction" /home/user/post/
# rli above as it helps prevent searching binary files aswell as text
#check freq of words
cat text.txt
#This is a file with many words.
#Some of the words appear more than once.
#Some of the words only appear one time.
# Using sed | sort | uniq
sed 's/\.//g;s/\(.*\)/\L\1/;s/\ /\n/g' text.txt | sort | uniq -c
avatar
jamied_uk
Admin

Posts : 2293
Join date : 2010-05-09
Age : 34
Location : UK

http://address-shortner.co.uk

Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum