简体   繁体   中英

How to store specific data on certain lines of an empty file using bash

例如,我想使用 bash 脚本将一些特定数据( var1=23var2=truevar3=alphavar4=55 )存储到文件的后续行中

line_1 -> var3, line_2 -> var4, line_3 -> var1, line_4 -> var2.

This should do it

printf '%s\n' "$var3" "$var4" "$var1" "$var2" > output.file

The printf command will re-use the format string until all the given data is used up.

If that is not sufficient, then please update your question to provide more clear requirements.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM