Live to Code

code to live

Uses for CAT


25 Mar 2012 | , ,

Append line(s) to end of a file

$ cat >> notes.txt
Get milk on the way home
Ctrl-D

Create a new file

$ cat > awesome_script.rb
#!/usr/bin/env ruby
puts "Hello World!"
Ctrl-D

Count occurrences of a string

$ cat <path_to_files> | grep -c <string>