Simpler Navigation for Servers and Operating Systems - Please Update Your Bookmarks
Completed: a much simpler Servers and Operating Systems section of the Community. We combined many of the older boards, so you won't have to click through so many levels to get at the information you need. Check the consolidated boards here as many sub-forums are now single boards.
If you have bookmarked forums or discussion boards in Servers and Operating Systems, we suggest you check and update them as needed.
General
cancel
Showing results for 
Search instead for 
Did you mean: 

How to devide one file to become two file

SOLVED
Go to solution
suryaj
Occasional Contributor

How to devide one file to become two file

I want to divide file Xx010801.SOL that has certain format to become file Header.txt and Line.txt that also have certain format.Can any one help me to resolve this problem??I have
attached all of files above.
Surya
3 REPLIES
harry d brown jr
Honored Contributor

Re: How to devide one file to become two file

If you or someone in your company knows perl you/they can accomplish this quite easily.
Live Free or Die
Praveen Bezawada
Respected Contributor

Re: How to devide one file to become two file

Hi
It looks complex , but as an example of what can be done I am appending a short script. This is for generating line.txt

#! /sbin/sh

awk '{ if ( $1 ~ /PCODE/ ){
print $1";"$2";"....
}
else if ( $3 ~ /KRT.*/ ) {
print count";"$1";"$2...
}
}' INPUTFILE > OUTPUTFILE

The point is to search for the required pattern and then display the results in the format you require..
Hope this helps....

...BPK...
harry d brown jr
Honored Contributor
Solution

Re: How to devide one file to become two file

Try this
Live Free or Die