Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

3
  • Avoid useless cat ! Use: awk < text.txt ... instead of cat text.txt | awk ... !! Commented Mar 24, 2013 at 10:10
  • could (better) be written: cd $(awk < test.txt '{printf "/folder/p/%s", substr($0,0,1)"/"substr($0,2,1)}') Commented Mar 24, 2013 at 10:12
  • @F.Hauri actually, it could be better written with a mild adaptation of @Beta's parameter expansion. x=$(<test.txt); cd "/folder/p/${x:0:1}/${x:1:1}" But that's not what I was going for. I was trying to explain why OP's solution didn't work. Commented Mar 24, 2013 at 15:10