-
-
Save vbajpai/3135250 to your computer and use it in GitHub Desktop.
Strip out Values from the KV pair in a Text File
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>> cat input.txt | |
k1:v1 k2:v2 k3:v3 ... | |
... | |
>> cat input.txt | python -c "import sys; \ | |
lines = sys.stdin.readlines(); \ | |
values = [[i.split(':')[1] for i in item] for item in \ | |
[line.split() for line in lines]]; \ | |
import os; [os.system('echo %s'%v) for v in \ | |
['\t'.join(value) for value in values]]" > output.txt | |
>> cat output.txt | |
v1 v2 v3 ... | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment