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

```
* With `awk`:

```
awk -v cnt=1004 '{ sub("^[^;]+", cnt++) } 1' file.csv

```
* With shell:

```
cnt=1004
while read -r line; do
    printf '%d;%s\n' $cnt "${line#*;}"
    let cnt++
done <file.csv

```
* With `jot`, `paste`, and a shell that can handle `<(...)` redirections:

```
paste -d\; <(jot $(wc -l <file.csv) 1004) <(cut -d\; -f2- file.csv)

```
* With Vim:

```
:let cnt=1004 | g/^/ s/^[^;]\+/\=cnt/ | let cnt+=1

```
* With Perl:

```
perl -F\; -lpe 'BEGIN{ $cnt=1004 } $F[0]=$cnt++; $_=join ";", @F' file.csv

```