This is an old revision of the document!
PHP's gd library is missing or unable to create PNG images
Linux Commands : file - search / replace
For the following cmds, the test.file contains:
1 cat barn food 2 dog house kibble 3 fish water food 4 cow pasture grass
grep
“searches the named input FILE for lines containing a match to PATTERN”
* Good for searching a file for a certain pattern
user@tim:~$ grep --help Usage: grep [OPTION]... PATTERN [FILE]... Search for PATTERN in each FILE or standard input. // snip // user@tim:~$ grep cat test.file 1 cat barn food user@tim:~$ grep food test.file 1 cat barn food 3 fish water food
awk
“pattern scanning and processing language”
* good for printing columnar data, note that the field separator (between the columns) can be anything (space, tab, colon, etc) and can be specified with -F
user@tim:~$ cat test.file |awk '{print $2}' cat dog fish cow
sed
“stream editor for filtering and transforming text”
user@tim:~$ sed s/cat/lion/ test.file 1 lion barn food 2 dog house kibble 3 fish water food 4 cow pasture grass (note that the input file //test.file// did NOT change) user@tim:~$ cat test.file 1 cat barn food 2 dog house kibble 3 fish water food 4 cow pasture grass user@tim:~$ sed s/cat/lion/ test.file > new.file (save into //new.file//) user@tim:~$ cat new.file 1 lion barn food 2 dog house kibble 3 fish water food 4 cow pasture grass user@tim:~$ cat test.file 1 cat barn food 2 dog house kibble 3 fish water food 4 cow pasture grass