Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Awk - delete rest of line

Status
Not open for further replies.

mbach

Technical User
Dec 12, 2000
24
US
All,
I need some help with some logic with awk. I am using awk
to parse backup output from piped information. I am extracting file paths that could not be backed up. I want to put some logic in my script that says....if the line contains "(WIN32" delete the part of the line starting with (WIN32 and everything else after it. This will give me just the file path that could not be backed up and I can then use the file paths in a backup command that will automatically rerun them. Below is sample output.

WRN - can't open file: C:\Program Files\CSCOpx\databases\cmf\cmf.db (WIN32
32: The process cannot access the file because it is being used by another process. )

Thanks!!!!
Mike
 


nawk -f win32.awk myFile.txt

#---------------- win32.awk
match($0, "\\(WIN32") { $0=substr($0, 1,RSTART-1) }
1


vlad
+----------------------------+
| #include<disclaimer.h> |
+----------------------------+
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top