Thursday, October 25, 2012

#shell scripting

So bash scripting in my opinion is cool but annoying
I want to access the file path and file name of a particular file but i don't know the file name. At least i know part of the file name. The files actual name is 'file_name_long.bin' and it is in the directory 'path/path/path/' from my current working directory.

So to get the file path I do something like

`ls path/path/path/file* | grep _name`

This will output : path/path/path/file_name_long.bin

And to get the file name

`ls path/path/path/ | grep _name`

This will output : file_name_long.bin

Hope this helps someone

No comments:

Post a Comment