|
Bash scripting: column-ize file of varying length strings
Hi,
First off, sorry for the bad title, I couldn't think of any better way of explaining the situation. I am writing a script that outputs the basename of a file, a '#', and the full file path of several files (the result of a find command) to a file. I would like to separate the file so that the basenames are in one column and the '#'s are all lined up in another column to the right (example as follows):
file1 # /root/file1
filenamelonger # /root/filenamelonger
f # /root/f
Right now I'm just echo'ing '\t\t' between the basename and the '#', but for longer file names or very short file names the '#'s are not in any particular column.
Any ideas on how I could get these to line up?
Thanks much!
|