Some times you may want to extract only the number from a file name, especially when you are working with a huge number of files to do some calculation or to run jobs.
This can be done by (for foo_bar_xyz_file_01_input.in)
-d is the delimeter
-f5 is the field where the number is present.
This can be done by (for foo_bar_xyz_file_01_input.in)
echo $f|cut -d_ -f5
Here, $f is the file name.-d is the delimeter
-f5 is the field where the number is present.
No comments:
Post a Comment