I have a newline delimited JSON file with entries like this:{id:eprints.ulster.ac.uk/view/year/2015.html,title:Items where Year is 2015 - Ulster Institutional Repository,url:eprints.ulster.ac.uk/view/year/2015.html}{id:eprints.ulster.ac.uk/view/year/2016.html,title:Items where Year is 2016 - Ulster Institutional Repository,url:eprints.ulster.ac.uk/view/year/2016.html}{id:eprints.ulster.ac.uk/view/year/2017.html,title:Items where Year is 2017 - Ulster Institutional Repository,url:eprints.ulster.ac.uk/view/year/2017.html}{id:eprints.ulster.ac.uk/10386/,title:Structural performance of rotationally restrained steel columns in fire - Ulster Institutional Repos,url:eprints.ulster.ac.uk/10386/}{id:eprints.ulster.ac.uk/10387/,title:Determining the Effective Length of Fixed End Steel Columns in Fire - Ulster Institutional Repositor,url:eprints.ulster.ac.uk/10387/}I only want blocks where the .id does not begin with eprints.ulster.ac.uk/view/So if the script was run on the above code snippet, the first 3 blocks would be deleted and the only blocks remaining would be:{id:eprints.ulster.ac.uk/10386/,title:Structural performance of rotationally restrained steel columns in fire - Ulster Institutional Repos,url:eprints.ulster.ac.uk/10386/}{id:eprints.ulster.ac.uk/10387/,title:Determining the Effective Length of Fixed End Steel Columns in Fire - Ulster Institutional Repositor,url:eprints.ulster.ac.uk/10387/}Can anybody help write an awk script to do this?
awk script to delete blocks in json
files;awk;json
Seeing as you specifically asked for an Awk solution:awk -F\ '$4 !~ /eprints.ulster.ac.uk\/view/' file > newfile