![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| To read and separate number and words in file and store to two new file using shell | kamakshi s | Shell Programming and Scripting | 2 | 06-26-2008 08:39 AM |
| Delete words in File 1 from File 2 | Enobarbus37 | Shell Programming and Scripting | 14 | 02-15-2008 08:09 AM |
| sed [delete everything between two words] | Orbix | UNIX for Dummies Questions & Answers | 3 | 12-25-2007 08:27 AM |
| Delete lines that contain 3 or more words? | revax | Shell Programming and Scripting | 5 | 12-11-2007 06:33 PM |
| sed option to delete two words within a file | klannon | UNIX for Dummies Questions & Answers | 4 | 04-15-2002 08:25 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread |
Rating:
|
Display Modes |
|
|
|
||||
|
If your words are separated by arbitrary numbers of white-space characters or the lines can begin with spaces, you could use
Code:
perl -n -e 'split; print "@_[10..$#_]\n"' file |
|
|||||
|
vi has no way of doing what you want to do using a standard builtin command. However you can call an external utility such as awk from within vi using the ":" command as shown in the following example
Code:
:1,$ !awk '{ for (i=11;i<=NF;i++) printf "\%s ", $i; printf "\n"; }'
Suppose we have the following file: Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 line1 line2 a b c d e f g h i j k l m n line4 Code:
11 12 13 line1 k l m n line4 Last edited by fpmurphy; 10-28-2008 at 01:40 PM.. Reason: f |
|
|||||
|
Quote:
P.S. I've just corrected it: 10 instead of 11. Reading the vi help pages: perhaps d10E is even more correct. Last edited by radoulov; 10-28-2008 at 04:07 PM.. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|