When I do
ruby -e 'print "file: #{ARGF.filename}"' test1.adoc
it prints test1.adoc, but what I am looking for is to have the extension removed, so I just get test1. If do
$ touch test1.adoc
$ ruby -e 'print "file: #{ARGF.filename}.sub('.adoc','')"' test1.adoc
Traceback (most recent call last):
1: from -e:1:in `<main>'
-e:1:in `filename': No such file or directory @ rb_sysopen - test1.adoc (Errno::ENOENT)
Using pop is temping to get a generic solution, but that seams harder going down that path...
Question
Can anyone figure out howto remove .adoc in my one-liner?