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" <[email protected]
<mailto:[email protected]>> 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%.*}"
    ls: cannot access 12720.txt%.txt: No such file or directory

    my intention here is to remove the ".txt" suffix so I got filename
    RLI-12720 and then ls it, am I missing anything?


    thanks!

    regards
    ping

    --


--
You received this message because you are subscribed to the Linux Users Group.
To post a message, send email to [email protected]
To unsubscribe, send email to [email protected]
For more options, visit our group at 
http://groups.google.com/group/linuxusersgroup
References can be found at: http://goo.gl/anqri
Please remember to abide by our list rules (http://tinyurl.com/LUG-Rules or 
http://cdn.fsdev.net/List-Rules.pdf)

Reply via email to