Active 3 years, 4 months ago. Viewed 10k times. I have a file with multiple lines which looks like that : brand,model,inches,price dell xps 13 macbook pro 13 asus zenbook 13 I want to delete the lines where the price is more than Improve this question. Rui F Ribeiro May the last field look like or Add a comment.
Active Oldest Votes. Improve this answer. I don't know if it's correct to say that grep -v deletes the matching lines. It simply inverts the matching so that it selects all non-matching lines. Andy Dalton Andy Dalton Archemar Archemar To show the sed command, we create a file called LinuxhintOS. In order to provide better information, we include these line numbers in the following content. The sed command can remove the lines of any range. As you can see, we removed the third, sixth, eighth, and last lines in this example.
Through the sed command, we remove those lines from the files which are not defined in the command, i. In the second part, we will see that with the help of the sed command, how we remove lines of a similar pattern. We can remove all lines starting with any character through the sed command.
For which we will use the following command. After applying the above command, all the lines from our file which started with uppercase letters will be removed, and the change in our file will be like this. Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams? Collectives on Stack Overflow.
Learn more. Asked 9 years, 5 months ago. Active 6 years, 4 months ago. Viewed 18k times. Sara Sara 2, 10 10 gold badges 45 45 silver badges 76 76 bronze badges. Add a comment. Active Oldest Votes. This is because of the backticks. Thor Thor 41k 10 10 gold badges silver badges bronze badges.
0コメント