Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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    2000

I 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
share|improve this question
up vote 3 down vote accepted

Use this:

egrep -e "^[0-9]" *.txt | cut -d ":" --output-delimiter=$'\t' -f 1- > test.txt

should work in Bash.

share|improve this answer
Perfect! Thank you. I checked the man page for cut and I didn't see anywhere that explained what "$" does. Could you please explain that bit to me? – gbrooks Feb 12 '14 at 9:21
@gbrooks: It's not actually 'cut', it's Bash. Bash expands the backslash escapes in strings like $'..' and only strings like that. '\t' is standard escape for a tab. – minerz029 Feb 12 '14 at 9:22
Ah ok, thank you. I just ran the command noticed I got twice as many lines as I should have (as noted by the assignment this is for). Without going too much off topic, does the fact that it uses Bash cause this? – gbrooks Feb 12 '14 at 9:24
@gbrooks: Shouldn't cause any problems using Bash. You may ask a new question, however. – minerz029 Feb 12 '14 at 9:25
Alright. Thank you so much for your help. – gbrooks Feb 12 '14 at 9:25

Alternately, 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    2000
share|improve this answer
From the question: "... cut (and ONLY cut) command ..." – muru Oct 20 '14 at 9:12

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.