How to convert spaces into tabs?
Answer:
You can use the unexpand command
# unexpand test.txt
Another example:# echo -e " A" | unexpand | sed 's/\t/F/g' FA
Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.
How to convert spaces into tabs?
Answer:
You can use the unexpand command
# unexpand test.txt
Another example:# echo -e " A" | unexpand | sed 's/\t/F/g' FA
How to convert tab into spaces?
Answer:
You can use the expand command
# expand test.txt
Another example:
# echo -e "\tA" | expand | sed 's/ /F/g'
FFFFFFFFA
Show the content of gzipped text file
Answer:
Use the zcat command, e.g.
# zcat text.gz
Sending both output and error message to same file
Answer:
Pick any of the following methods
1.
./foobar &> output.txt
2.
./foobar >& output.txt
3. Most popular
./foobar > output.txt 2>&1
Save program output and error to different files
Answer:
Assume you are going to execute a program called foobar, and it emits to both the standard output and standard error. You want to save them into different files, try
# ./foobar 1> output.txt 2> error.txt
or simply
# ./foobar > output.txt 2> error.txt