I have a text file for ex:
ABCD#sh run
aaaaaaaaa
bbbbbbbbb
ccccccccc
ABCD#sh int
dddddddd
eeeeeeee
ABCD#sh xvy

and so on....

I want to parse the lines between ABCD# and the next ABCD#.
And send this parse output to CSV file or excel like

aaaaaaaa dddddddd
bbbbbbbb eeeeeeee
cccccccc

Please help!!

Recommended Answers

All 3 Replies

hi,

you need to concatenate lines based on their position after a pettern.

use an array which index is reset when ABCD# is met, and incremented for each line.

more or less

if line == ABCD#
then
   reset index
else
   array[index++]=array[index]" "line
endif

what language do intend to use? how big is the file?

Thank u Watael!
I will prefer shell and next in C
what will this reset index do?

what will this reset index do?

guess!
this is supposed to restore the index to the start value of an array's index

in bash (do you have bash?) arrays start with index 0.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.