mirror of
https://github.com/xmengnet/the-art-of-command-line.git
synced 2024-12-25 02:26:30 +08:00
Merge pull request #51 from adamm/master
Add 'grep . *' oneliner trick for high-level scan of a directory
This commit is contained in:
commit
5e493924cc
1 changed files with 6 additions and 0 deletions
|
@ -242,6 +242,12 @@ A few examples of piecing together commands:
|
|||
cat a b b | sort | uniq -u > c # c is set difference a - b
|
||||
```
|
||||
|
||||
- Use `grep . *` to visually examine all contents of all files in a directory. Useful for directories filled with config settings, like /sys /proc /etc.
|
||||
```sh
|
||||
cd /proc/sys/net/ipv4
|
||||
grep . *
|
||||
```
|
||||
|
||||
- Summing all numbers in the third column of a text file (this is probably 3X faster and 3X less code than equivalent Python):
|
||||
```sh
|
||||
awk '{ x += $3 } END { print x }' myfile
|
||||
|
|
Loading…
Reference in a new issue