Started testing some awk stuff

This commit is contained in:
Jack-Benny Persson 2013-12-27 20:17:26 +01:00
parent 6549cb4cde
commit 49583af607
2 changed files with 10 additions and 3 deletions

View File

@ -0,0 +1 @@
Adam Bertil Cesar David Erik Fredrik

View File

@ -1,5 +1,11 @@
# Misc notes on sed & awk #
```
sed -n '/^[MmLl]ånga/p' file.txt
sed 's/^/Spock -- /g' file.txt
```bash
sed -n '/^[MmLl]ånga/p' file.txt # Match Många/många/Långa/långa.
sed 's/^/Spock -- /g' file.txt # Put "Spock -- " in front of
# every row.
awk '{ print $1 $2 $3 }' names.txt # Print field 1, 2 and 3.
awk '{ print $1" "$2" --> "$3 }' names.txt # Print field 1, 2 and 3, with
# spaces between 1 and 2 and
# --> between 2 and 3.
```