Urgent
I have a big file called the game, and want to find all the lines that do NOT have the word "shozbot" in it, and I want to sort them alphabetically, and save that in a file called "squiggy". How would I do that in one line of commands?
Thnks |
Sorry, but it's hard to take your post seriously - with a subject of urgent and a task that sounds like it was made up... What have you done so far and what specific problem are you having?
|
Seriously, pick a more appropriate title for your post next time.
As for the command, here's a basic example (you'll need to add options depending on your requirements): Code:
grep -v shozbot game.txt | sort > squiggy.txt |
Win32sux has answered your question.
I give you some explanation here. Code:
grep -v "pattern" fileName Remove the -v option and it will print only those lines that contain at least one match of the "pattern". So, Code:
grep -v "shozbot" game Next, we pipe this output to the sort command which displays the sorted lines: Code:
grep -v "shozbot" game | sort Code:
grep -v "shozbot" game | sort > squiggy |
All times are GMT -5. The time now is 10:06 AM. |