LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Please help me with the following shell script (https://www.linuxquestions.org/questions/linux-newbie-8/please-help-me-with-the-following-shell-script-688584/)

slayer_ace 12-05-2008 01:22 PM

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.

helptonewbie 12-05-2008 01:27 PM

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

pixellany 12-05-2008 01:35 PM

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

arunmathew1984 12-06-2008 01:49 AM

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


All times are GMT -5. The time now is 04:39 PM.