I desperately need a small script which deletes everything in a particular .txt file when "Abs = {" appears till "},", and also when "B-1 = {" appears till "},"
I would like all the text in between of those instances to be deleted, however, other text to be unedited (kept as it is).
@article{Test1:2011aa,
Abs = {Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.},
Author = {Lorem Ipsum and Ipsum Lorem},
Date-Added = {2013-02-27 2:55:51 +0200},
Title = {Geometric analogue of holographic reduced representation},
Year = {2009},
B-1 = {http://www.google.com}}
@book{Test2:2012bb,
Abs = {Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.},
Author = {Lorem Ipsum and Ipsum Lorem},
Date-Added = {2012-02-27 3:44:41 +0400},
Year = {2010},
B-1 = {http://www.google.com}}
Desired output:
@article{Test1:2011aa,
Author = {Lorem Ipsum and Ipsum Lorem},
Date-Added = {2013-02-27 2:55:51 +0200},
Title = {Geometric analogue of holographic reduced representation},
Year = {2009}}
@book{Test2:2012bb,
Author = {Lorem Ipsum and Ipsum Lorem},
Date-Added = {2012-02-27 3:44:41 +0400},
Year = {2010}}
I would like the last brackets to be taken to the previous row, and the comma in the previous row to be deleted... so that the last line it ends up like this.
Year = {2010}}
Notice that, the last line can be "Year" or anything else, but always the B-1 comes to the end, and I would like the above thing to happen (the last brackets to be taken to the previous row, and the comma in the previous row to be deleted).
I save the script in Desktop as script.awk and then try to execute it, but I get an error like:
awk -f script.awk
awk: syntax error at source line 1 source file script.awk
context is
awk >>> ' <<<
awk: bailing out at source line 1