linux - copy after specific words and past after specific words -


i want copy , paste task in easy way. had file has on 3000 lines. how can in linux?

text file

#: bib field 111 liblibrarian = "main entry--meeting name"; update  marc_subfield_structure set liblibrarian = "temel gİrİŞ--toplanti adi", libopac =   #: bib sub 111 f liblibrarian = "date of work"; update  marc_subfield_structure set liblibrarian = "eserin tarihi", libopac =   #: bib sub 111 k liblibrarian = "form subheading"; update  marc_subfield_structure set liblibrarian = "alt başlık biçimlendir", libopac =   #: bib sub 111 l liblibrarian = "language of work"; update  marc_subfield_structure set liblibrarian = "eserin dili", libopac =   #: bib sub 111 n liblibrarian = "number of part/section/meeting"; update  marc_subfield_structure set liblibrarian = "parça/bölüm/toplantı sayısı", libopac =  

i want

update  marc_subfield_structure set liblibrarian = "toplantı yeri", libopac = "toplantı yeri" liblibrarian = "location of meeting"; update  marc_subfield_structure set liblibrarian = "relator kodu", libopac = "relator kodu" liblibrarian = "relator code"; update  marc_subfield_structure set liblibrarian = "eserin adı", libopac = "eserin adı" liblibrarian = "title of work"; update  marc_subfield_structure set liblibrarian = "relator terim", libopac = "relator terim" liblibrarian = "relator term"; 

probably can other tool awk or sed. think done by, following:

  1. create file contains 'where liblibrarian ..' part following command:

    grep 'where liblibrarian' <file> > first_file

  2. create file contains 'update marc_subfield_structure..' part:

    grep 'update marc_subfield_structure' <file> > second_file

  3. now have 2 files each line contains part of final like build. have paste them column-wise using following command (you can adjust separator needs).

    paste second_file first_file | column -s $'\t' -t

so last command paste lines inserting separator between them.


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -