What's the command syntax for stripping out the tar.gz file extension in a bash command line (not script file). Thanks!
prompt/> ls *.tar.gz | <what comes here?>
What's the command syntax for stripping out the tar.gz file extension in a bash command line (not script file). Thanks!
prompt/> ls *.tar.gz | <what comes here?>
How about using sed
to remove the extension and print:
ls | grep tar.gz | sed 's/\.tar\.gz//g'
or simply:
ls *.tar.gz | sed 's/\.tar\.gz//g'
or using parameter substitution:
for file in *.tar.gz; do echo "${file%.tar.gz}"; done
Thank you!
Another variation on bipinajith's theme:
ls | sed -n '/\.tar\.gz$/s///p'
Regards,
Alister