bash - extract value by position and maximum length -


i have extract pattern @ ( position 13 , maxlength= 10 ) files :

file 1 :

fjlksflsf    content1   blabla kjodeddek    content1   blabla fdfkjlsdd    content1   blabla     fsdffsdfs    content1   blabla .             . . dzedojioj    content1   blabla 

i use script extract value "content1"

file 2

fjlsdfsf    content22   blabla gfgttsdd    content22   blabla gzdfldfd    content22   blabla     azefsgtg    content22   blabla .             . . fsffsdfj    content22   blabla 

same thing here script should loop files , extract right value @ position 13 till position 23 print on screen, exemple extracted value second file "content22"

in awk. if want position 13, length 10:

$ awk '{print substr($0,13,10)}' file1  content1   content1   ... 

you print second field:

$ awk '{print $2}' file1 content1  content1  ... 

Comments

Popular posts from this blog

mysql - Dreamhost PyCharm Django Python 3 Launching a Site -

java - Sending SMS with SMSLib and Web Services -

java - How to resolve The method toString() in the type Object is not applicable for the arguments (InputStream) -