![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Alternate way for echo. | senthil_is | Shell Programming and Scripting | 5 | 03-05-2008 09:12 AM |
| alternate rows of a file | dr46014 | Shell Programming and Scripting | 3 | 08-25-2007 06:16 AM |
| Alternate command for cut | Mohammed | Shell Programming and Scripting | 2 | 10-20-2006 07:42 AM |
| Alternate to RARP Solaris 5.6 & 5.8 | dmerg59 | IP Networking | 2 | 06-28-2005 08:28 PM |
| alternate lines from two files | SummitElse | UNIX for Dummies Questions & Answers | 1 | 02-24-2005 09:54 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
alternate lines
Hi,
I'm new to Unix. I want to read the all the lines from a text file and write the alternate lines into another file. Please give me a shell script solution. file1 ----- one two three four five six seven newfile(it should contain the alternate lines from the file1) ------- one three five seven please let me know a solution Thanks in advance Pstanand |
|
||||
|
Code:
sed -n 'p;n' filename -- print the odd line sed -n 'n;p' filename -- print the even line |
| Sponsored Links | ||
|
|