How do I use cut to make tab the delimiter?
Matthew Martinez
I am working with the egrep command and I need to pair with the cut (and ONLY cut) command to change a ":" into a tab. For example change:
Blahblahblah:2000to:
Blahblahblah 2000I currently have this, but it turns the ":" into "/t" and not tab:
egrep -e "^[0-9]" *.txt | cut -d ":" --output-delimiter="/t" -f 1- > test.txt 2 Answers
Use this:
egrep -e "^[0-9]" *.txt | cut -d ":" --output-delimiter=$'\t' -f 1- > test.txtshould work in Bash.
4Alternately, you can also use the tr command, if your need is to just replace the delimiter as follows
echo "Blahblahblah:2000" | tr ':' '\t'
You will get the following output
Blahblahblah 20001