398 | | === sed === |
399 | | '''sed''' is a powerful text stream editor. There are many uses of this program, but the most common is its search and replace function. Combined with regular expressions, this command can be used to seek out complex strings in your code and replace them with modifications. Please visit [[http://www.grymoire.com/Unix/Sed.html|Sed - An Introduction and Tutorial]] for more information. |
400 | | {{{ |
401 | | [tulaneID@cypress1 ~]$ cat animals |
402 | | dog |
403 | | Dog |
404 | | cat |
405 | | Racoon |
406 | | DOG |
407 | | bullfrog |
408 | | Little Doggie |
409 | | |
410 | | [tulaneID@cypress1 ~]$ sed 's/dog/bird/g' animals |
411 | | bird |
412 | | Dog |
413 | | cat |
414 | | Racoon |
415 | | DOG |
416 | | bullfrog |
417 | | Little Doggie |
418 | | }}} |
419 | | |
420 | | === awk === |
421 | | '''awk''' is a programming language used to modify files. One common use of '''awk''' is printing specific columns of a text stream or file. |
422 | | {{{ |
423 | | [tulaneID@cypress1 ~]$ cat sample.data |
424 | | 0.3 0.22 1.8 |
425 | | 3.1 2.34 3.0 |
426 | | 0.2 1.0 3.2 |
427 | | |
428 | | [tulaneID@cypress1 ~]$ awk '{print $1 " " $3}' |
429 | | 0.3 1.8 |
430 | | 3.1 3.0 |
431 | | 0.2 3.2 |
432 | | }}} |
433 | | The above command printed out the 1st and 3rd columns of the '''sample.data''' file. |
434 | | For more information on awk please visit [[http://www.grymoire.com/Unix/Awk.html|Awk - A Tutorial and Introduction]]. |