Command to delete words less than 5 characters?
Hi
I am trying to remove words from a text file that are less than 5 characters. I have tried grep and sed but don't seem to be removing every occurrence that is less than 5 characters long. I probably doing something stupid :) but any help would be greatly appreciated. Cheers Daz |
this might work for what you want: `cat file.in |sed 's/ .\{1,5\} //g' >file.out`
|
No that is one of the commands I have tried myself but the file that is created is empty.
|
try this
sed -ni '/^.\{5\}/!p' filename do it without the i first that will print the results on the screen but will not change the file. The i will do the sed command inline, which means it will do the command and edit the filename without creating a new file. EDIT: Oops this only deletes lines that are 5 characters or less. |
All times are GMT -5. The time now is 04:56 AM. |