How to add number to beginning of each line?

Edward

This is what I normally use to add numbers to the beginning of each line:

awk '{ print FNR " " $0 }' file

However, what I need to do is start the number at 1000001. Is there a way to start with a specific number like this instead of having to use line numbers?

anubhava

You can just add 1000001 to FNR (or NR):

awk '{ print (1000001 + FNR), $0 }' file

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to append number at the beginning of each line [PHP]?

From Dev

how to add a character at the beginning of each line in Richtextbox

From Dev

add number beginning of line

From Dev

How to add line number into each line?

From Dev

Add a char to the beginning and end of each line in a file

From Dev

Add spaces to the beginning of each matching line

From Dev

Add a different string in the beginning of each line

From Dev

sed : how remove selected number of white spaces (tabs) from beginning of each line

From Dev

How to remove a character at the beginning of each line in Richtextbox

From Dev

Notepad++ - how to add character to beginning of line

From Dev

How to add line to beginning of sed output

From Dev

Add a prefix to beginning of each line depending on its size

From Dev

Add text to beginning and end of each line using batch/cmd

From Dev

Add string at beginning and in-between of each line in a file

From Dev

Add numbers at the beginning of each line and replace asterisks with numbers in a document

From Dev

Add a random number at the end of each line of file

From Dev

Notepad++ add number in each line

From Dev

How can I prepend a random letter/number to the beginning of each filename?

From Dev

How can I prepend a random letter/number to the beginning of each filename?

From Dev

Adding text at the beginning of each line

From Dev

How to Add line Number in this TextEditor

From Dev

Add and number blank line above each line in a file

From Dev

How can i add a string to the beginning of every line in a file with sed?

From Dev

How can I add auto-increment number at the end of the each line in my text document via Vim

From Dev

add characters at the beginning of a line in R

From Dev

How to specify number of characters in each line in python?

From Dev

How to count the number of characters on each line in vim?

From Dev

How to number each line in the output using a for loop?

From Dev

How to count the number of appearances of a word in each line

Related Related

  1. 1

    How to append number at the beginning of each line [PHP]?

  2. 2

    how to add a character at the beginning of each line in Richtextbox

  3. 3

    add number beginning of line

  4. 4

    How to add line number into each line?

  5. 5

    Add a char to the beginning and end of each line in a file

  6. 6

    Add spaces to the beginning of each matching line

  7. 7

    Add a different string in the beginning of each line

  8. 8

    sed : how remove selected number of white spaces (tabs) from beginning of each line

  9. 9

    How to remove a character at the beginning of each line in Richtextbox

  10. 10

    Notepad++ - how to add character to beginning of line

  11. 11

    How to add line to beginning of sed output

  12. 12

    Add a prefix to beginning of each line depending on its size

  13. 13

    Add text to beginning and end of each line using batch/cmd

  14. 14

    Add string at beginning and in-between of each line in a file

  15. 15

    Add numbers at the beginning of each line and replace asterisks with numbers in a document

  16. 16

    Add a random number at the end of each line of file

  17. 17

    Notepad++ add number in each line

  18. 18

    How can I prepend a random letter/number to the beginning of each filename?

  19. 19

    How can I prepend a random letter/number to the beginning of each filename?

  20. 20

    Adding text at the beginning of each line

  21. 21

    How to Add line Number in this TextEditor

  22. 22

    Add and number blank line above each line in a file

  23. 23

    How can i add a string to the beginning of every line in a file with sed?

  24. 24

    How can I add auto-increment number at the end of the each line in my text document via Vim

  25. 25

    add characters at the beginning of a line in R

  26. 26

    How to specify number of characters in each line in python?

  27. 27

    How to count the number of characters on each line in vim?

  28. 28

    How to number each line in the output using a for loop?

  29. 29

    How to count the number of appearances of a word in each line

HotTag

Archive