DEV Community

Judy
Judy

Posted on

Reverse Rows in a Text File #eg51

Problem description & analysis

Below is text file txt.txt:

abc

123

First line

We are trying to reverse the order of rows to generate a new file as follows:

First line

123

abc

Solution

Write the following script p1.dfx in esProc:

Image description

Explanation:

A1   Reverse the order of rows in the text file and output result to result.txt.

SPL open source address

Download

Top comments (3)

Collapse
 
puchaczov profile image
Jakub Puchała

Looks nice, don’t need to loop anymore 😀

Collapse
 
esproc_spl profile image
Judy

Yes.

Collapse
 
ngtduc693 profile image
Duc Nguyen Thanh

Great skills