Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7034057
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T01:08:24+00:00 2026-05-28T01:08:24+00:00

Whenever I execute a linux command that outputs multiple lines, I want to perform

  • 0

Whenever I execute a linux command that outputs multiple lines, I want to perform some operation on each line of the output. generally i do

command something | while read a
do
  some operation on $a;
done

This works fine. But my question is, Is there some how I can access each line by a predefined symbol( dont know how to call it) /// something like $? .. or .. $! .. or .. $_

Is it possible to do

cat to_be_removed.txt | rm -f $LINE

is there a predefined $LINE in bash .. or the previous one is the shortest way. ie.

cat to_be_removed.txt | while read line; do rm -f $line; done;
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T01:08:25+00:00Added an answer on May 28, 2026 at 1:08 am

    xargs is what you’re looking for:

    cat to_be_removed.txt | xargs rm -f
    

    Watch out for spaces in your filenames if you use that one, though. Check out the xargs man page for more information.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want some personally developed JavaScript code to execute whenever I load a page
I'd like to execute some code whenever a (any!) message box (as spawned by
Can I create an event so I can execute some javascript whenever an element
The point of this timer is to execute some code whenever it's midnight. So
I want to execute a JavaScript function every second, or whenever the time position
I want to execute some code in a Django model when it is first
Whenever I execute an INSERT OR REPLACE command to sqlite3, it's actually create duplicate
I am trying to create an SMS broadcast receiver that will execute whenever a
Whenever I indent HTML in PHP mode, emacs (22.1.1, basic install on Redaht Linux
Whenever a record is deleted or updated on a form, I want to save

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.