LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


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

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


Hello,
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, 02:27 PM   #2
helptonewbie
Member
 
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...
http://bash.cyberciti.biz/academic/w...ven-line-file/

Which is one method
 
Old 12-05-2008, 02:35 PM   #3
pixellany
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: http://www.grymoire.com/Unix/Sed.html
 
Old 12-06-2008, 02:49 AM   #4
arunmathew1984
Member
 
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 12:14 PM.
 
  


Reply


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 07:24 AM
help with execute mulitple shell script within shell script ufmale Programming 6 09-13-2008 01:21 AM
Alias or shell script to confirm 'exit' commands from a shell rose_bud4201 Programming 2 03-08-2006 03:34 PM
shell script problem, want to use shell script auto update IP~! singying304 Programming 4 11-29-2005 06:32 PM


All times are GMT -5. The time now is 02:20 PM.

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