Here’s a simple sed command to replace multiple spaces into a comma delimited file.
sample.txt
one two three four |
The sed command.
sed 's/ \+ /,/g' sample.txt > sample2.txt |
sample2.txt
one,two three,four |
cloud engineer
Here’s a simple sed command to replace multiple spaces into a comma delimited file.
sample.txt
one two three four |
one two three four
The sed command.
sed 's/ \+ /,/g' sample.txt > sample2.txt |
sed 's/ \+ /,/g' sample.txt > sample2.txt
sample2.txt
one,two three,four |
one,two three,four
Get a count of the number of files in a directory.
# using ls ls | wc -l ls -Aq | wc -l # include hidden files find . ! -name . -prune -print | grep -c / find .//. ! -name . -print | grep -c // # using tree if installed. yum install tree. apt-get install tree tree |
# using ls ls | wc -l ls -Aq | wc -l # include hidden files find . ! -name . -prune -print | grep -c / find .//. ! -name . -print | grep -c // # using tree if installed. yum install tree. apt-get install tree tree
Find the biggest files in the current directory. Sort by from large to small. Display only the top 20. Display in human readable format.
find -type f -exec du -Sh {} + | sort -rh | head -n 20 |
find -type f -exec du -Sh {} + | sort -rh | head -n 20