mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2024-12-23 17:41:41 +00:00
[bash/en] Fixed overflowing line.
This commit is contained in:
parent
04eed19763
commit
19f6739cba
@ -235,11 +235,13 @@ uniq -d file.txt
|
|||||||
cut -d ',' -f 1 file.txt
|
cut -d ',' -f 1 file.txt
|
||||||
# replaces every occurrence of 'okay' with 'great' in file.txt, (regex compatible)
|
# replaces every occurrence of 'okay' with 'great' in file.txt, (regex compatible)
|
||||||
sed -i 's/okay/great/g' file.txt
|
sed -i 's/okay/great/g' file.txt
|
||||||
# print to stdout all lines of file.txt which match some regex, the example prints lines which begin with "foo" and end in "bar"
|
# print to stdout all lines of file.txt which match some regex
|
||||||
|
# The example prints lines which begin with "foo" and end in "bar"
|
||||||
grep "^foo.*bar$" file.txt
|
grep "^foo.*bar$" file.txt
|
||||||
# pass the option "-c" to instead print the number of lines matching the regex
|
# pass the option "-c" to instead print the number of lines matching the regex
|
||||||
grep -c "^foo.*bar$" file.txt
|
grep -c "^foo.*bar$" file.txt
|
||||||
# if you literally want to search for the string, and not the regex, use fgrep (or grep -F)
|
# if you literally want to search for the string,
|
||||||
|
# and not the regex, use fgrep (or grep -F)
|
||||||
fgrep "^foo.*bar$" file.txt
|
fgrep "^foo.*bar$" file.txt
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user