Latest LQ Deal: Linux Power User Bundle
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 12-05-2008, 01:22 PM   #1
LQ Newbie
Registered: Dec 2008
Posts: 1

Rep: Reputation: 0
Please help me with the following shell script

I'm not too good with shell scripts yet, and having a hard time with the following task:
I need to write a script that separates even and odd lines in a file and then writes them in two different files.
Any help is apriciated, thanks in advance.
Old 12-05-2008, 01:27 PM   #2
Registered: Aug 2006
Location: England Somewhere
Distribution: Mandriva, PCLinuxOS, Karoshi, Suse, Redhat, Ubuntu
Posts: 518

Rep: Reputation: 39
A quick google search of...
bash separate odd and even lines

the first hit being this webpage...

Which is one method
Old 12-05-2008, 01:35 PM   #3
LQ Veteran
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
This certainly sounds like homework....

Tell us more about why you need to do this, and show what you have tried.

One tool to look into is SED---it has the ability to take action based on line #. Really good tutorial here:
Old 12-06-2008, 01:49 AM   #4
Registered: Nov 2008
Posts: 31

Rep: Reputation: 15
Did you try using SED. Google for it and you will find tons of ways in which you can use it to achieve what you want.

Linux Archive

Last edited by arunmathew1984; 12-20-2008 at 11:14 AM.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to ssh from a shell script ? For ppl who can write shell scripts. thefountainhead100 Programming 14 10-22-2008 06:24 AM
help with execute mulitple shell script within shell script ufmale Programming 6 09-13-2008 12:21 AM
Alias or shell script to confirm 'exit' commands from a shell rose_bud4201 Programming 2 03-08-2006 02:34 PM
shell script problem, want to use shell script auto update IP~! singying304 Programming 4 11-29-2005 05:32 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:24 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration