PC & IT SUPPORT MADE EASY FORUM
Would you like to react to this message? Create an account in a few clicks or log in to continue.

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

Go down

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

Post by jamied_uk 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
jamied_uk
jamied_uk
Admin

Posts : 2951
Join date : 2010-05-09
Age : 41
Location : UK

https://jnet.sytes.net

Back to top Go down

Back to top

- Similar topics

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