The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 11-01-2007
lyonsd lyonsd is offline
Registered User
  
 

Join Date: Jan 2005
Posts: 35
Help using IFS to break up a record (ksh)

I have a program that produces output similar to this:


Code:
 16010001pe3m_313101.ver
 16010001pe3m_313101.ver

 16010001pe4m_0
 16010001pe4m_0

 16010001pe4m_1
 16010001pe4m_1

 16010001pe4m_313101.ver
 16010001pe4m_313101.ver

 group_defs.txt
 Group Definition File

I have a ksh script where I am trying to get it to print like this:


Code:
16010001pe3m_313101.ver 16010001pe3m_313101.ver
16010001pe4m_0              16010001pe4m_0
16010001pe4m_1              16010001pe4m_1
16010001pe4m_313101.ver 16010001pe4m_313101.ver
group_defs.txt                   Group Definition File

Here is what the code looks like:


Code:
	typeset -L80 relative_path
	typeset -L80 description
	typeset -i count=0
	OFS=IFS
	IFS='
'
	for i in $(program)
	do
		print $i
	done

So I need to get two lines into two separate variables, and I need iterate through the loop when a blank line is encountered.

I've tried using...


Code:
IFS='
'
while read var1 var2
do
  print $var1 $var2
done < $(program)

But that doesn't work either.

How do you set IFS to a blank line?

Suggestions welcome.

Thanks.