awk suites it better:
awk -F'\t' '{print $5}' file
Using sed:
sed -r 's/^([^\t]+\t){4}([^\t]+).*$/\2/' file
Size
26
4096
Frage
Permissions links Owner Group Size Date Time Directory or file
-rwxr--r-- 1 User1 root 26 2012-04-12 19:51 MyFile.txt
drwxrwxr-x 3 User2 csstf 4096 2012-03-15 00:12 MyDir
Note that each space is a tab space.
I need to go to the size column. How can I do that using sed
command. Because I cannot continue my work due to that. I don't know how to split and take certain part of the line using sed
command.
Lösung
awk suites it better:
awk -F'\t' '{print $5}' file
Using sed:
sed -r 's/^([^\t]+\t){4}([^\t]+).*$/\2/' file
Size
26
4096