shell - Separating string using linux command -


suppose have folder containing files below formats:

hostname.anothername.ouut.ext filename.another.anot.xxx 

now want separate string inside of first dot , list in file. should linux command? here, hostname inside of first name. output in separate file. output format given below:

  hostname   filename  

i able separated words file containing texts hostname.xxxxx.yyyy, filename.xxxx.tttt etc using

      cut -d. -f1 <<end hostname.anothername.ouut.ext filename.another.anot.xxx end  

but hostnae.xxxxx.yyyy, filename.uuuu.xxxxx etc not text here these file containing in folder.

cut simplest solution:

cut -d. -f1 <<end hostname.anothername.ouut.ext filename..another.anot.xxx end 
hostname filename 

for file in *;     prefix=${file%%.*}     echo "$prefix" done 

Comments

Popular posts from this blog

javascript - jquery or ashx not working -

opencv - DataType<cv::detail::deriv_type>::depth what is it used for -

python 3.x - Mapping specific letters onto a list of words -