I have 5,000 text files of journal article citations. I am trying to extract only the abstract portion. Meaning that I want to keep the same text document and delete all the other text except for abstract. I am very new to Linux and I have been trolling your board for a while.how to extract words that after keywordexecute command on all file in a directoryfor file in testnano my.shwhile read variable do  sed '0,/^Abstract$/d' done <fileHere is an example of a file its similar to a scientific journal articleSponsor     : Beckman Res Inst Cty Hope      1500 E. Duarte Road      Duarte, CA  910103000    /   -NSF Program : 1114      CELL BIOLOGYFld Applictn: 0000099   Other Applications NEC                            61        Life Science Biological                 Program Ref : 9285,Abstract    :          Studies of chickens have provided serological and nucleic acid                           probes useful in defining the major histocompatibility complex                           (MHC) in other avian species.  Methods used in detecting genetic                         diversity at loci within the MHC of chickens and mammals will be                         applied to determining the extent of MHC polymorphism within                             small populations of ring-necked pheasants, wild turkeys, cranes,                        Andean condors and other species.  The knowledge and expertise                           gained from working with the MHC of the chicken should make for                          rapid progress in defining the polymorphism of the MHC in these                          species and in detecting the polymorphism of MHC gene pool within                        small wild and captive populations of these birds.       Thanks to KasiyA and John1024 I now understand how to get portions of lines from a directory. Here is how you do it for sub directoriesfind -name *txt -type d -exec sed -i '0,/^Abstract/d' *.txt {} \;For more details about the find command click HERE OR this link from stackoverflow Here
How to get portion of lines from all .txt files in a directory?
text processing;sed
As I understand it, you want to change a series of file in-place.  You want to delete all up to and including the first line that consists in total of Abstract.  If those files are in the current directory and are all named with a .txt extension, then use:sed -i '0,/^Abstract$/d' *.txtSince this will overwrite the old files and in case something goes wrong, don't use this without having a backup.This may require GNU sed (which is standard on Linux). How it works-iThe -i option tells sed to edit files in-place.  The old file will be overwritten.0,/^Abstract$/dThis command tells sed to delete (d) all lines from the first (number 0) up to and including the first line that matches the regular expression ^Abstract$.  The caret, ^, matches at the start of the line and the dollar sign matches at the end of the line.  Thus, this regex matches on a line that contains only the word Abstract with no other characters on the line.*.txtThis tells the shell to select all files in the current directory that have the .txt suffix.UpdateThis will delete all lines in each file up to the first line that starts with Abstract:sed -i '0,/^Abstract/d' *.txtBecause the $ has been removed, this regular expression only requires that the line begin with Abstract.