The shell script is trying to add a line containing a different string of the same format on a specific line in the yml file.
Assuming there are multiple lines of the same format like
-test1 en: 'English' -test2 ja: 'Japanese' -test3 id: 'Indonesian'
,below this line
I would like to add in a similar format every two lines, such as
-test4 de: 'German' -test5 sp: 'Spanish'
, using a script such as sed or grep from a shell file such as a
I think I thought it was wrong for a while,
target_row = cat ./test.sh | grep 'Indonesian'
After output, I was stuck at the point where I wanted to use it by storing it in a variable with redirect.
If i have other better ways, please give me a professor.
The terminal uses Iterm2 on Mac, so the kernel is UNIX.
Answer # 1
There is a command to do exactly what you want to do: "Specify the target line with a line number or regular expression and add a line after it."
- i wrote a shell script like the one below, but the variables are not reflected properly when i crontab
- The specific usage of the SHELL script read command
- Java call shell script to solve the problem of passing parameters and permissions
- How to use shell script to index mysql
- Kill a bunch of mysql databases, just such a shell script (recommended)
- Shell script to monitor a process to pull up a process after it has stopped unexpectedly
- Shell script to operate mysql database to delete duplicate data
- Shell script batch delete es index method
- Example of several methods for shell script to read content line by line from file
- Shell script regular expressions, grep, sed, awk
- Shell script determines user input
- Shell script method for looping through parameters with for loop
- The establishment and execution of a Linux shell script
- Shell script nginx automation script
- Linux Crontab Shell script to implement second-level timed tasks
- shell to implement Tetris script
- Three ways to call another script in a shell script
- shell script print chess board
- Usage of awk instruction in shell script
- Expect-free implementation of shell script
- unix - frequency of automatic database update of locate command (macos)
- macos (osx) - command not found: mapfile
- linux - string conversion by shell script
- i want to package a unix executable into app
- macos (osx) - i want to standard input to a file written in go using a pipeline
- linux - what is the terminal that can be used with macbook?
- how to check path, meaning of error message
- linux - i want to create three files with different extensions with the same time, minute, and second in a shell script
- linux - i want to specify an option of "more than one character" in getopts of the shell script