Question: Application for which I'm writing service file expects its `STDIN` to be connected to the `tty`, or in other words to be run on the terminal. `Systemd` has the following settings which do the trick for my application, however here I use statically configured `tty` path, which could potentially already be used by other application or simply do not exist on the system.

```
StandardInput=tty-force
TTYPath=/dev/tty30

```

It would be much nicer if `systemd` (or me for that matter) could figure out unused `pseudoterminal` pair and use that instead.

Answer: 
**awk** solution:

```
awk -F';' 'BEGIN{ i=1004 }{ $1=i++ }1' OFS=';' file

```

* `-F';'` - input field separator
* `i=1004` - starting *increment*

The output:

```
1004;03;07;30;35;43;01;03
1005;08;12;16;22;26;06;07
1006;02;20;28;29;44;03;09
1007;08;11;15;20;30;03;08
1008;09;11;12;19;30;04;09
1009;08;15;25;27;42;01;04
1010;05;07;26;36;39;02;10

```

---

Or you may pass the variable `i` from "outside":

```
awk -F';' '{ $1=i++ }1' i=1004 OFS=';' file

```
Use Python, it's easy to read, understand, and maintain - and it's available on most Unix installations:

```
python - << "EOF" > outfilename
for index, line in enumerate(open("filename"), start=1004):
    linedata = line.strip().split(';')
    linedata[0] = str(index)
    print(';'.join(linedata))
EOF

```