So the command below does not give me any output in Jupyter Notebook with iPython:
IP = '62.172.72.131'
!cat hits.csv | grep {IP} | awk '{print $1}'
I have tried both double and single "$" sign and none of them works. If I only use one pipe in the command, it works fine. For example:
IP = '62.172.72.131'
!cat hits.csv | grep {IP}
!cat hits.csv | awk '{print $1}'
Anyone know why this is happening? Thanks!
I think I figured this out. The "$" and "{" and "}" are all special characters in iPython, so I have to escape them by doubling them.
IP = '62.172.72.131'
!cat hits.csv | grep {IP} | awk '{{print $$1}}'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With