H
H
HitGirl2020-11-15 13:04:27
linux
HitGirl, 2020-11-15 13:04:27

How to redirect input from a pipeline?

Hello!
Can you please tell me how can I redirect the pipeline to the while loop?
In the code below, the pipeline is executed after the while, but we want it to be executed before the loop.

while read line
do
 echo $line
done < sorted | cut -f 1 -d ' ' | uniq

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
shurshur, 2020-11-15
@HitGirl

cat sorted | cut -f 1 -d ' ' | uniq |
while read line
...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question