Note that there are some explanatory texts on larger screens.

plurals
  1. POperl + numeration word or parameter in file
    text
    copied!<p>I need help about how to numeration text in file.</p> <p>I have also linux machine and I need to write the script with perl</p> <p>I have file name: file_db.txt</p> <p>In this file have parameters like name,ParameterFromBook,NumberPage,BOOK_From_library,price etc Each parameter equal to something as name=elephant</p> <p>My question How to do this by perl</p> <p>I want to give number for each parameter (before the "=") that repeated (unique parameter) in the file , and increase by (+1) the new number of the next repeated parameter until EOF</p> <p>lidia</p> <p>For example</p> <p>file_db.txt before numbering</p> <pre><code> parameter=1 name=one parameter=2 name=two </code></pre> <p>file_db.txt after parameters numbering</p> <pre><code> parameter1=1 name1=one parameter2=2 name2=two </code></pre> <ul> <li>other examples </li> </ul> <p>Example1 before</p> <pre><code> name=elephant ParameterFromBook=234 name=star.world ParameterFromBook=200 name=home_room1 ParameterFromBook=264 </code></pre> <p>Example1 after parameters numbering</p> <pre><code> name1=elephant ParameterFromBook1=234 name2=star.world ParameterFromBook2=200 name3=home_room1 ParameterFromBook3=264 </code></pre> <p>Example2 before</p> <p>file_db.txt before numbering</p> <pre><code> lines_and_words=1 list_of_books=3442 lines_and_words=13 list_of_books=344224 lines_and_words=120 list_of_books=341 </code></pre> <p>Example2 after</p> <p>file_db.txt after parameters numbering</p> <pre><code> lines_and_words1=1 list_of_books1=3442 lines_and_words2=13 list_of_books2=344224 lines_and_words3=120 list_of_books3=341 </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload