$ ls *txt | wc -l 18 This shows us that we had 18 text files. Some other common Unix programs which it might be useful to know about and which are often incorporated into pipes are: Program Function Common switches Counts words/lines (only lines) wc -l (select non matching lines) -v Selects lines matching patterns grep (case insensitive) -i show this many head Shows the top of a large file -[number] Shows the bottom of a large file show this many lines tail -[number] Sorts a list of values case insensitive sort -f Deduplicates consecutive identical list members ignore case uniq -i So if, for example I wanted to find the number of different lines for chr1 were in a text file I could do something like: grep chr1 some_file.txt | sort | uniq | wc -l
$ ls *txt | wc -l 18 This shows us that we had 18 text files. Some other common Unix programs which it might be useful to know about and which are often incorporated into pipes are: Program Function Common switches wc Counts words/lines -l (only lines) grep Selects lines matching patterns -v (select non matching lines) -i (case insensitive) head Shows the top of a large file -[number] show this many tail Shows the bottom of a large file -[number] show this many lines sort Sorts a list of values -f case insensitive uniq Deduplicates consecutive identical list members -i ignore case So if, for example I wanted to find the number of different lines for chr1 were in a text file I could do something like: grep chr1 some_file.txt | sort | uniq | wc -l