On 7/11/2012 6:33 PM, Jeremiah Bess wrote:
> If all you are trying to do is ls a list of files with the same prefix
> and extension, just do ls RLI-12720.txt*, like you did in your first
> example. I'm not clear as to what else you are trying to accomplish.
>
not that easy, actually.
I'm working in vim and is trying to define a ex command to process the
current file based on the filename.
say I'm editing a file named RLI-12720.txt in vim
after some change I want to :
1) save it
2) convert it into html, so I'll get a new file: RLI-12720.html
3) upload (cp) that .html file into web server and test it within browser
so this is the one liner:
:w|!asciidoc -a toc -a toclevels=6 % > /dev/null 2>&1;cp RLI-12720.html
/mnt/public_html/temp/
this works fine, but I want to generalize and save it to make it useful
for all other files, regardless of the filename.
in case you don't use vim, % here means the current filename:
RLI-12720.txt in this case. so what I want to achieve is:
based on current filename "%", generate new filename that will be used
in subsequent command, in this case cp NEW-FILE-NAME ...
thanks
> Jeremiah Bess
> Penguin Geek, Network Ninja, Father of Five
>
> On Jul 11, 2012 4:55 PM, "ping" <
songpi...@gmail.com
> <mailto:
songpi...@gmail.com>> wrote:
>
> experts:
>
> I'm trying following Parameter Expansion but somehow it just does't
> work -- I do remember previously something like that works fine!
>
> ping@640g-laptop:/data/backup/__Juniper/MX/RLI$ ls RLI-12720*
> RLI-12720 RLI-12720.html RLI-12720-slides.html
> RLI-12720-slides.txt RLI-12720-slides.txt~ RLI-12720.txt
> RLI-12720.txt~ RLI-12720.xml
>
>
> ping@640g-laptop:/data/backup/__Juniper/MX/RLI$ ls "${RLI-12720.txt%.*}"