Hi I have a script where I put info from one command into a file with below:
Code:
#!/bin/bash
gnokii --monitor once > get_sms_id
what I now want is for the script to search for the string: "callid: " inside this file and output the number which comes after "callid: "
The file contains a line which says:
Code:
CALL0: SMS 0644411 () (callid: 4, duration: 0 sec)
So I want to "extract" 4 into a variable but I dont know how to do this.
So the number always come after "id: " and before "," so the number could be 4 or 4976.
Next

, if the "CALL0:" in the file outputs: IDLE like this: CALL0: IDLE I want the script to exit.
Can anyone help me with this? I would be trule greatful!
If you need more info, just post here and I'll try to explain better.
Thanks in advance!