Wednesday 7 December 2011

Finding files ( SharePoint migration )

Scripted migration means logs full of errors, and sometimes the meaningful stuff is on a line or 2 above:

awk "{lines[NR] = $0} /ps1:45 char:37/ {print lines [NR-7]} {delete lines[NR-7]}" imp2


This handy little awk line gets the line 7 lines above the string you are looking for ( in this case it’s ps1:45 char:37


another way is to use grep –b 3 searchedstring inputfile.txt


which gets all 3 lines before the string, and –a will get the lines after

No comments:

Post a Comment