When I use this command:ls /var/log/packages/*SBo|cut -d / -f 5it returns this:webcore-fonts-3.0-noarch-3_SBowinetricks-20120923-noarch-1_SBowireshark-1.12.1-x86_64-1_SBowxGTK-2.8.12-x86_64-3_SBoI want to remove everything starting from a numeric field (the rest of the lines should be omitted). So I want it to look like:webcore-fontswinetrickswiresharkwxGTKHow to do this? I think awk is perfect, but I don't know how to delete the rest of the lines (but only if numeric).
Awk remove field only if numeric
sed;awk
You can try : ls /var/log/packages/*SBo| sed 's/-[0-9].*//'