so thanks to this forum, I currently have this code, which takes an output from a programme I have and saves it in a file:
#!usr/bin/python
import os
os.chdir('./P574/J0998-1034')
os.system('vap -c freq *.SFTC > 1400list.txt')
I wanted to add a filter (so take only lines that contained “1369.000”, so I amended the last line to:
os.system('vap -c freq *.SFTC | egrep 1369.000 > 1400listfilt.txt')
But I really want it to take lines that contain EITHER “1369.000” OR “1433.000”. I tried:
os.system('vap -c freq *.SFTC | egrep 1369.000|1433.000 > 1400listfilt.txt' )
But I got the error message: “sh: 1433.000: command not found
egrep: write error: Broken pipe”
How can I make it check for two values? Also.. is this the best way to do what I am trying to do?
Thank you!
I would surround the arguments in single quotes as such:
The shell is telling you that it could not redirect the output of
egrepto the program1433.000which doesn’t exist.