reading lines in pairs from file in ksh


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting reading lines in pairs from file in ksh
# 1  
Old 02-08-2008
reading lines in pairs from file in ksh

I need to read pairs of lines from a file and compare them. We can assume that the number of lines in the file is even. Can i do it in korn shell?
# 2  
Old 02-08-2008
Well, first, the obligatory question: is this a homework question? If so, we can't help you.

Assuming that it's not, can you show us what you've gotten so far?

Regards
# 3  
Old 02-08-2008
it's not a homework, it's a workwork. So far i got nothing as the only tool i know is while read, and it does not let you read the second line (as far as I know).

Is there is way to detect EOF in ksh?
# 4  
Old 02-08-2008
First try to Google on "compare files unix".
Once you have more specific questions, please return and we'd be more than happy to answer them!

Regards
# 5  
Old 02-08-2008
What is not specific here? And when you say "we" who exactly do you mean?

I doubt you read my question because it has nothing to do with comaring files.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

ksh Script, Reading A File, Grepping A File Contents In Another File

So I'm stumped. First... APOLOGIES... my work is offline in an office that has zero internet connectivity, as required by our client. If need be, I could print out my script attempts and retype them here. But on the off chance... here goes. I have a text file (file_source) of terms, each line... (3 Replies)
Discussion started by: Brusimm
3 Replies

2. Shell Programming and Scripting

Remove lines with duplicate pairs where AB is equal to BA

I have a file with four columns like dmn10003t1 PF00001 PF00022 dmn12390t1 dmn10008t1 PF00069 PF00027 dmn9781t1 dmn10008t1 PF00068 PF00027 dmn9781t1 dmn10008t1 PF00069 PF00069 dmn9781t1 dmn12390t1 PF00069 PF00076 dmn10003t1 I want to create a new file by comparing the repeated word pairs... (2 Replies)
Discussion started by: sammy777
2 Replies

3. UNIX for Dummies Questions & Answers

Reading file and exclude in ksh

I have a text file containing some file names. And I've a directory containing files with different name. I want to do some operaration (deleting) on the files which are NOT listed on the text file. Im using KSH. PLEASE HELP !!!!! Urgent Help!!!!! (2 Replies)
Discussion started by: maheshbabu
2 Replies

4. Shell Programming and Scripting

File w/ many line pairs--how do I order based on 1st lines only?

I have a file in which the data is stored in pairs of lines. The first line (beginining with ">") is a header, the second line is a sequence. I would like to sort the file by species name. Desired output for the example file: I can use sort -t'_' -k2 to alphabetize headers in the... (1 Reply)
Discussion started by: pathunkathunk
1 Replies

5. Shell Programming and Scripting

Reading the contents of the file and splitting using ksh

We're using a ksh script for installing one product. I've another config file, I'd need to read this configuration file from my main script Content of the Configuration file:... (2 Replies)
Discussion started by: bittu129
2 Replies

6. Shell Programming and Scripting

How to swap order of pairs of lines?

This seems to be a question whose answer uses sed or awk. For a file like: a b c d e How to swap the order of the line pairs, to end up with: b a d c e All lines from the original file need to wind up in the output file. (8 Replies)
Discussion started by: rd5817
8 Replies

7. Shell Programming and Scripting

concatenate lines in pairs

Hi, I have a text file with the following contents /C=IT/O=INFN/OU=Personal Certificate/L=Napoli/CN=Some guy /C=IT/O=INFN/CN=INFN CA /O=Grid/O=NorduGrid/OU=uninett.no/CN=Another guy /O=Grid/O=NorduGrid/CN=NorduGrid Certification Authority /C=TW/O=AP/OU=GRID/CN=Someone else... (5 Replies)
Discussion started by: kerl
5 Replies

8. Shell Programming and Scripting

ksh questions - Reading columns and lines on unix

1-) For the command below, I want to read second column: 32751. How will I get it ? $ ps -ef|grep deneme U00 32751 22745 0 16:30 pts/1 00:00:00 ksh deneme U00 32762 32132 0 16:30 pts/2 00:00:00 grep deneme 2-) For the command below, how will I read all lines line by line? For... (1 Reply)
Discussion started by: senem
1 Replies

9. Shell Programming and Scripting

reading from file in ksh

hi, it seems i can read using cat file | while read line but when i tried reading using while read line < myfile then the last line kept on being returned why? thanks (2 Replies)
Discussion started by: JamesByars
2 Replies

10. Shell Programming and Scripting

Help reading an input file in KSH

First I' d like to say you guys are awesome. :) I have a word document that I cut and paste into Textpad and it removed all the fancy formatting which is fine with me. I WinScp'd it to the box and and called it inputfile.txt. Opened it in vi and don't see any special characters or stuff that... (2 Replies)
Discussion started by: zilla30066
2 Replies
Login or Register to Ask a Question