1834987 Members
1944 Online
110073 Solutions
New Discussion

script to ignore numbers

 
Nitin Nigam
Occasional Advisor

script to ignore numbers

Hi
Im using the command "ls -1 | awk '{print $NF}' | cut -f1 -d'.' | sort -u"
this command cuts the filename before period.
once I get the file I tar and gzip the files.

the files in directory are :
triton_int.Oct10.1 triton_int.Oct2.1 triton_int.out triton_int.Oct10.2 triton_int.Oct8.1 triton_int_06278.Sep24.1 triton_int_23669.Sep19.2 triton_int_25019.Sep25.1
triton_int_06726.Sep24.1

but whats happening is its creating a triton_int.tar.gz file which contains all the other files with *_int_0644... (that means numbers file as well) and it also creates a separate *.tar.gz file with numbers (i.e. triton_int_06726.tar.gz)but I don't want my script to create second gzip file.
What I want is get the filename before the period (thats what above command is doing) and if there are any numbers ignore them.

Thanks
2 REPLIES 2
Kafsat Taiyus
Advisor

Re: script to ignore numbers

awk '{print $NF}' test |cut -f1 -d '.'|cut -f1,2 -d '_'|sort -u
T G Manikandan
Honored Contributor

Re: script to ignore numbers

#ls|awk -F "." '{print $1}'|grep -v [0-9]

# ls|awk -F "." '{print $1}'|awk -F "_[0-9]" '{print $1}'