Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Adding solution from JS:</p> <pre><code>awk -F'&gt;' '/table name/{$NF="slonyid="q x++ q FS}1' q='"' inputFile </code></pre> <p>Try this:</p> <pre><code>awk -F'&gt;' '/table name/{print $(NF-1)" slonyid""=""\""NR-1"\"""&gt;"}' inputFile </code></pre> <p>Adding test:</p> <pre><code>$ cat temp.txt table name="dbname.tablename" lots of text here&gt; table name="dbname.tablename" lots of text here&gt; table name="dbname.tablename" lots of text here&gt; table name="dbname.tablename" lots of text here&gt; table name="dbname.tablename" lots of text here&gt; table name="dbname.tablename" lots of text here&gt; table name="dbname.tablename" lots of text here&gt; table name="dbname.tablename" lots of text here&gt; table name="dbname.tablename" lots of text here&gt; table name="dbname.tablename" lots of text here&gt; table name="dbname.tablename" lots of text here&gt; table name="dbname.tablename" lots of text here&gt; table name="dbname.tablename" lots of text here&gt; table name="dbname.tablename" lots of text here&gt; table name="dbname.tablename" lots of text here&gt; $ awk -F'&gt;' '/table name/{print $(NF-1)" slonyid""=""\""NR-1"\"""&gt;"}' temp.txt table name="dbname.tablename" lots of text here slonyid="0"&gt; table name="dbname.tablename" lots of text here slonyid="1"&gt; table name="dbname.tablename" lots of text here slonyid="2"&gt; table name="dbname.tablename" lots of text here slonyid="3"&gt; table name="dbname.tablename" lots of text here slonyid="4"&gt; table name="dbname.tablename" lots of text here slonyid="5"&gt; table name="dbname.tablename" lots of text here slonyid="6"&gt; table name="dbname.tablename" lots of text here slonyid="7"&gt; table name="dbname.tablename" lots of text here slonyid="8"&gt; table name="dbname.tablename" lots of text here slonyid="9"&gt; table name="dbname.tablename" lots of text here slonyid="10"&gt; table name="dbname.tablename" lots of text here slonyid="11"&gt; table name="dbname.tablename" lots of text here slonyid="12"&gt; table name="dbname.tablename" lots of text here slonyid="13"&gt; table name="dbname.tablename" lots of text here slonyid="14"&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

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