Замена частей файлов

man tail говорит:

   -n, --lines=[+]NUM
          output the last NUM lines, instead of the last 10;
          or use -n +NUM to output starting with line NUM

поэтому вы можете сделать

tail -n +51 myfile >>tmp
2
06.01.2017, 15:37
1 ответ

Вместо замены всех строк в newpw.txt , было бы лучше чтобы создать новый файл, перебирая имена пользователей в старом, например:

cut -d: -f1 pw.txt | while read -r user; do
    echo "$user:$(openssl passwd ABCXYZ)"
done > newpw.txt
mv newpw.txt pw.txt
2
27.01.2020, 22:10

Теги

Похожие вопросы