Skip to content

Instantly share code, notes, and snippets.

@alivx
Created June 15, 2020 05:27
Show Gist options
  • Save alivx/d33bcee07826833a5905c9d9dd011da3 to your computer and use it in GitHub Desktop.
Save alivx/d33bcee07826833a5905c9d9dd011da3 to your computer and use it in GitHub Desktop.
Split one log file into multiple files based on string or prefix
Exmaple log file:
```Log
New Request 1
get user-id (Ref_8a28)
update user history (Ref_7a27)
send notification (Ref_6a26)
user info updated (Ref_5a25)
New Request 2 (Ref_4a24)
get user-id (Ref_3a23)
update user history (Ref_2a22)
send notification (Ref_1a21)
user info updated (Ref_0a20)
```
#Command
csplit -f output_file_ service.log "/New Request/" '{*}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment