FG
💻 Software

Process each line of a file in bash

Fresh7 days ago
Mar 15, 202626996 views
Confidence Score0%
0%

Problem

When I want to do something with each line in a file I usually write The gzip is just an example it can be anything. What I'm wondering is if there is another way to get the lines than ?

Error Output

cat my_file | while read a
do
gzip "$a"
done

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: Process each line of a file in bash

Low Risk

You don't need to use : I don't think there's a simpler way though.

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment