Home Ask Login Register

Developers Planet

Your answer is one click away!

Arian.N February 2016

Find certain line in file and extract part of it

I am trying to make a Bash script that will look in a file for a certain line (IR Freq. = 23.23) and copy the 23.23 from it and send it through serial interface (ttyS0).

The line will move around the file and the number will change a lot!


user3894156 February 2016

you can use the below script

grep -r "IR Freq." filename | cut -d '=' -f 2 | sed -e 's/^[[:space:]]*//'

Post Status

Asked in February 2016
Viewed 3,604 times
Voted 12
Answered 1 times


Leave an answer

Quote of the day: live life