grep | dd create huge file | sed | touch
To search over many fles and fnd out in which of the fles a certain text matches use:
$ grep - l linux sample1. txt sample2 . txt
sample1. txt
sample2. txt
To recursively search for a text over many directories of descendants use:
$ grep " text" . -R - n
Instead of using the current time for the timestamp, we can specify the time and date with
which to stamp the fle as follows:
$ touch -d "Fri Jun 25 20: 50: 14 IST 1999" filename
Another way to print symbolic links is to use find as follows:
$ find . - type l - print
The following command will create a fle that is 1 GB in size.
$ dd if=/dev/zero of=loopbackfile. img bs=1G count=1
We can also read from stdin as follows:
$ echo - e "this is
sed can be used to replace occurrences of a string with another string in a given text. It can
be matched using regular expressions.
$ sed ' s/pattern/replace_string/' file
& is a string which corresponds to match string for the given pattern. But we can also match
the substrings of the given pattern. Let's see how to do it.
$ echo this is digit 7 in a number | sed ' s/digit \([0-9] \) /\1/'
this is 7 in a number
-----------
How to count a particular word
ubuntu@ubuntu:~$ cat newfile
some other info
this is some new
this is some new file with new data
ubuntu@ubuntu:~$ grep -c some newfile
3
ubuntu@ubuntu:~$
$ grep - l linux sample1. txt sample2 . txt
sample1. txt
sample2. txt
To recursively search for a text over many directories of descendants use:
$ grep " text" . -R - n
Instead of using the current time for the timestamp, we can specify the time and date with
which to stamp the fle as follows:
$ touch -d "Fri Jun 25 20: 50: 14 IST 1999" filename
Another way to print symbolic links is to use find as follows:
$ find . - type l - print
The following command will create a fle that is 1 GB in size.
$ dd if=/dev/zero of=loopbackfile. img bs=1G count=1
We can also read from stdin as follows:
$ echo - e "this is
sed can be used to replace occurrences of a string with another string in a given text. It can
be matched using regular expressions.
$ sed ' s/pattern/replace_string/' file
& is a string which corresponds to match string for the given pattern. But we can also match
the substrings of the given pattern. Let's see how to do it.
$ echo this is digit 7 in a number | sed ' s/digit \([0-9] \) /\1/'
this is 7 in a number
-----------
How to count a particular word
ubuntu@ubuntu:~$ cat newfile
some other info
this is some new
this is some new file with new data
ubuntu@ubuntu:~$ grep -c some newfile
3
ubuntu@ubuntu:~$
Comments
Post a Comment