User Tools

Site Tools


using python instead of tr $filename | grep -i coupon | \
python -c "import sys; print(','.join(line.strip() for line in sys.stdin))"

sort lines by length

import fileinput
print("".join(sorted(fileinput.input(), key=len)))

On the command line:

% cat random_snippets.txt | python -c 'import fileinput; print("".join(sorted(fileinput.input(), key=len)))'


See also:

sql string in clause

cat junk3.txt | \
python -c "import sys; print('\'', '\', \''.join(line.strip() for line in sys.stdin), '\'', sep='')"
python_cli.txt · Last modified: 2021/02/28 06:27 by raju