I am trying to run a very long shell command in IPython using the !
operator. How do I split the command onto multiple lines?
For instance,
!awk -v c=0 '{{if (a[$$1]) print $$0 a[$$1]; else if (b[$$2]) print $$0 b[$$2] else {{print $$0 " common_" c; a[$$1] = b[$$2] = " common_" c; c++}}}}' foo.txt | column -t
A command like this quickly becomes unreadable.
Use \
, press enter, continue typing, use another \
and enter until you are done.
E.g.
In [1]: !ls \
...: *.txt
aws-forum.txt encyclic.txt
In [2]:
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments