Remove line from file and read file line by line

I have a file output.txt. File looks like this

name1 10
name2 2
name3 5

I get a number n and I need to remove all lines which has number (after name) smaller or equal to n number.

After that I need to write lines from file and my output must be like this:

Output: 'name1 10'
Output: 'name2 20'
Output: 'name3 5'

Thank you for your help

Welcome to The UNIX and Linux Forums.

Since the capabilities of the utilities available and the utilities available on UNIX, Linux, and similar systems vary from system to system, please always tell us what operating system you're using when you start a new thread in the Shell Programming and Scripting forum. And, since the syntax and options accepted by shells and the built-ins provided by shells vary from system to system and shell to shell, please also always tell us what shell you're using when you start a new thread in the Shell Programming and Scripting forum.

I'm confused by your requirements. You talked about getting a number n, but you didn't say anything about what value was assigned to n to get the output that you say must be produced. And, I don't see anything in your description that would cause an input line:

name2 2

to be converted to the output:

Output: 'name2 20'

Please tell us what operating system you're using, what shell you're using, how the value n is to be determined, and under what circumstances the second value on an input line is supposed to be multiplied by ten.

And show us what you have tried to solve this problem on your own. If we don't know where you're stuck, it is hard for us to guess what we need to do to help you learn how to do what you want to do.

2 Likes