CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
Converting multiple lines into single line.

 



beecha
Novice

Jan 9, 2018, 4:06 AM

Post #1 of 1 (95 views)
Converting multiple lines into single line. Can't Post

Hi All,

HAPPY NEW YEAR ALL
i am reading text file which contains below multiple lines.

i am reading every line one by one as a string.
if the line is started with WAR i need to check for '{' and make all the line into a single line till it ends with '}' without considering the '&' character.

EX:
war eligible, init =0*DEC0, ev (VARIABLE){1*BIN0,2*DEC3,6*BIN4,
& 5*BIN43,6*DEC32,
& 5*BIN43,7*DEC32}

CONVERTED TO:war eligible, init =0*DEC0, ev (VARIABLE){1*BIN0,2*DEC3,6*BIN4,5*BIN43,6*DEC32, 5*BIN43,7*DEC32}

war wear, init =1*DEC1, ev (VARIABLE) {
& 1*BIN0,2*DEC3,6*BIN4,
& 5*BIN43,6*DEC32,
& 5*BIN43,7*DEC32,6*DEC32,6*DEC3,
& 8*BIN3,6*DEC34
}

CONVERTED TO:war wear, init =1*DEC1, ev (VARIABLE) { 1*BIN0,2*DEC3,6*BIN4, 5*BIN43,6*DEC32, 5*BIN43,7*DEC32,6*DEC32,6*DEC3, 8*BIN3,6*DEC34 }

please help me with this how to convert.SmileSmile

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives