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:
create file contains 'where liblibrarian ..' part following command:
grep 'where liblibrarian' <file> > first_file
create file contains 'update marc_subfield_structure..' part:
grep 'update marc_subfield_structure' <file> > second_file
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
Post a Comment