All Questions
306
questions
-1
votes
1
answer
57
views
Using git bash "find" and "sed" correctly. Do I have the best solution? [closed]
I am using git bash on Windows.
I have a large set (thousands) of c/c++ files with autogenerated headers that I want to replace. My plan is first to strip the headers then apply new ones.
These ...
0
votes
1
answer
50
views
Recursive search and replace a string with dot in text files on Mac
Team, I see there are multiple similar questions but I did try some answers and still not able to get what I want. I want to replace a text as "product-ui-test-creds.json" to "vaulted-...
1
vote
1
answer
64
views
Sed replace single text with content of file
I have a question regarding using sed.
I have a JSON file and I want to get it inserted in another file.
What I'm trying is to get all the contents of the .json file which contains 4500 lines, and ...
0
votes
1
answer
216
views
Updating yaml key in yaml frontmater of markdown file using find and sed
I have thousands of shared markdown notes in hundreds of repertories with yaml frontmatter. (This frontmatter at the top of the files is between two lines containing only ---. )
The frontmatter has a ...
0
votes
1
answer
35
views
Find and sed together fail in macOS
This command finds files if I remove from exec onwards.
find src -name "*.tsx" -o -name "*.ts" -exec sed -i "" "s/LayerSelector/LayerRenderer/g" {} \;
The ...
0
votes
1
answer
102
views
Find and replace with Sed in a text file
{"date":"12:44", <-----Need to keep the second colon in this line only
"temp":"38.6",
"tempTL":"38.6",
"tempTH":"46.9&...
-1
votes
1
answer
170
views
How to replace every occurrence of a path in all files withing a directory and its sub-directories
I want to replace every occurrence of /home/nxaXXXXX/simulation/MSIP/DPGA/ by /home/nxfXXXXX/TestCases/ in all files within a directory, here /home/nxfXXXXX/TestCases/, and its sub-directories.
I've ...
0
votes
1
answer
60
views
Error with array and sed WP config replacement
newwpuser=$cpuser"_"$wpuser
newwpdb=$cpuser"_"$wpdb
wpdb=($(find . -name "wp-config.php" -print0 | xargs -0 -r grep -e "DB_NAME" | cut -d \' -f 4))
wpuser=($(...
2
votes
3
answers
103
views
Replace word in files with random words from txt using sed
I have over 500 site and i want to replace a specific word in all of them with random words from a text file.
Folders structure
www
- site1
- - idex.html
- site2
- - index.html
-site3
- - index.html
...
0
votes
1
answer
4k
views
Find a string and replace in all files inside a directory and sub-directory
I am thinking to replace a string in linux, the idea is to find all files having abc as string and replace with xyz inside a directory and all sub-directories.
Can you suggest how can I do this with ...
0
votes
3
answers
165
views
Sed sed: -e expression #1, unterminated `s' command
I'm trying to run this sed command using Renovate, the tool doesn't really matter I think but I'm getting the following error
"find . -name release-notes.md -type f -exec sh -c 'sed -i '1s#^#some ...
0
votes
2
answers
60
views
Adding text to a specific (row,column) in csv with sed
Improved question for clarity:
Hello there so I have about 2000 csv files
One master file called fileaa.csv
And 1999 description files called fileaa-1.csv, fileaa-2.csv, fileaa-4.csv... (some numbers ...
1
vote
3
answers
351
views
sed: Replace string at a given position in a textfile
I am trying to search and replace value within a huge file (40 millions) for the substring(30 characters) that starts at position 235 in a file called testfile.txt. I want to mask the substring with (&...
0
votes
1
answer
524
views
find and rename files gives bash 'no such file or directory' error
I'm trying to strip the numbers and - from the file name.
Below are the files.
ui-service-3.100.503505.json
kibana-store-end-3.103.103505.json
api-application-3.4003.10350665.json
find . -type f -...
0
votes
1
answer
89
views
How to iterate over two files and find all occurrences in file1 matching file2, line by line, then replace with content from file3
I have a file I am trying to initiate a global find and replace pattern. I want to find all occurrences of file2, line by line, within file1, then replace these occurrences with file3 which match the ...