Process multiple lines in a text file

Hi All

I have text file like this:

a=21ej
c=3tiu32
e=hydkehw
f=hgdiuw
g=jhdkj
a=klkjhvl
b=dlkjhyfd
a=yo
c=8732

Any way I can process data from first a to just before of second a, and then second a to just before of 3rd one.

Just fetching records like that will help, I mean if I can store data in a file like this.

Try:

sort -t= infile

how you like to process rows in between a(s) ?
here is a way to print lines in between pattern

awk '$1=="a"{c=1;next} $1=="b"{c=0} c{print}' FS== OFS== infile

instead of print you can add your line processing rule

I actually want to process first set of data before 2nd a

 
a=21ej
c=3tiu32
e=hydkehw
f=hgdiuw
g=jhdkj

Then from 2nd a to before of 3rd one

a=klkjhvl
b=dlkjhyfd

and so on.... :slight_smile: