I have a text stream which has n lines and each line is one word.
I would like to write something like a for loop that VAR gets at every iteration the i’th line (from line 1 until EOF) and to run a command on each.
Thanks!
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
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.
In some cases the
xargscommand can be sufficient:This assumes that the way of passing the words from the stream to the command is by specifying that word as an argument for the command.
If this is not the case @aioobe’s suggestion might be more suitable for you.