D
D
Dmitry Chernyavsky2016-11-02 16:03:31
linux
Dmitry Chernyavsky, 2016-11-02 16:03:31

What is the correct way to use grep/awk/sed?

There is a file in which the software writes data in this form:
string.1 <character tab> OK
string.2 <character tab> OK
string.3 <character tab> OK
There is a script that should parse data from another source using the contents the above file via grep -f filename . The problem is that data from the source comes in the form of just string.1, string.2 and string.3 without "OK", i.e. are not included in the template. Now a crutch is working there, which reads the first file, cuts out everything "OK" from it, saves the result to an intermediate file, which is already slipped into the script. But I believe that you can make the whole operation less crutch, somehow cutting out this "OK" on the fly.
What is the best way to do this?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry, 2016-11-02
@plin2s

cut -f1 -d$'\t'
awk '{ print $1 }'

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question