shell text wrangling Flashcards
<
redirecting input
>
redirecting output
1>
redirecting output
2>
redirecting error
/dev/null
a special device file that discards all data written to it
head
used to print the first n lines (default 10)
tail
used to print the last n lines
.
any single character
[abc]
any of the characters in the brackets
[a-z]
any character in the range a-z
[^a-c]
means not containing a, b or c
(a|b)
either a or b
*
0 or more
+
1 or more
?
exactly 0 or 1
{X}
exactly X characters of the specific kind
{X,Y}
means we want X to Y characters of the specific kind
start of the line
$
end of the line
sed -g
replaces all matches, not only the first one
awk -F””
field delimiter
~ matches
!~ does not match
$0
whole line
$N
N field
FS
input field separator
OFS
output field separator
NF
number of fields
NR
number of records(lines)
RS
record separator
ORS
output record separator
FILENAME
current file name