how to rearrange a text file with awk
Hi,
I have a text file which is created by the output of a du command and it looks like this: Code:
127M /home/jackieayres/Maildir The result I'd like would be: Code:
127M /home/jackieayres/Desktop 108K /home/jackieayres/My Folders Is this something awk can do? I looked at paste but I wasn't too sure what was best. Thanks, |
Here, it is.
Code:
cat file | awk -F"/" '{print $3}' | uniq > names Code:
127M /home/jackieayres/Maildir 108K /home/jackieayres/My Folders Let me check if in case I can find something useful for you. |
you can do all that with just awk going through the file just ONCE.
Code:
#!/bin/bash Code:
$ ./shell.sh |
Brilliant. Thanks very much now I have what I need and have my first script finished and work :D
Thank you to both of you ghostdog74 & vikas027 |
Quote:
Thanks in adv. |
if formatting needs to be done, it can done using printf with left/right justification format specifiers, eg %10s, %-15s etc...
|
Quote:
Is there something like I can define that any particular column, say column 3 starts from a particular column of screen say 35th (i.e. after 34 characters from left). |
Quote:
Quote:
|
Ghostdog74 I am just looking at your code again
Quote:
Thanks, |
Quote:
|
All times are GMT -5. The time now is 03:01 PM. |