Skip to content

Instantly share code, notes, and snippets.

@jucke
Created April 21, 2020 22:06
Show Gist options
  • Save jucke/3bc6df688115b517a6fb5b7917991fdd to your computer and use it in GitHub Desktop.
Save jucke/3bc6df688115b517a6fb5b7917991fdd to your computer and use it in GitHub Desktop.
Diff transformer
Let's say you have a diff:
```
838a839
> p088x0zn|
841a843
> p088x0zt|
1167a1170
> p088z03m|
etc.
```
And you need these pids in format 'p088x0zn', 'p088x0zt', `p088z03m` for a query.
This will achieve desired transformation:
cat diff.txt | grep -v ">" | grep -v "^[0-9c0-9]" | grep -oE "p[a-z0-9]{7}" | sed "s/.*/'&'/" | paste -sd, -
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment