1
vote
2answers
219 views

batch find/replace using sed or awk

In every file with filename matching pattern1 I want to search for lines which start with pattern2, and add some string in a new line above those matched lines. As a simple example suppose I'm ...
3
votes
3answers
68 views

merge pieces of file together

I have a directory tree of files I need to loop through and reformat the lines. can I do this with sed with some combination of find? for each file, I'll need to adjust the text in the file from ...
1
vote
1answer
325 views

Using find and sed to rename several subfolders

What I am trying to do is rename folders that are anywhere in the current tree, not neccessarily directly in the working directory. What I need to do is: "A 1" becomes "A 01" "A 2" becomes "A 02" ...
3
votes
2answers
363 views

Flatten a folder structure to a file name in Bash

I'm trying to convert files from this structure: foldera/folderb/filec.png to: foldera_folderb_filec.png I'm halfway there: find . -type f -name "*.png" | sed 's@^./@@g;s@/@-@g' which ...
1
vote
2answers
220 views

Find/SED keeps ignoring some hidden files

Is there a way to ensure find/sed include hidden files during processing?
1
vote
3answers
2k views

Using sed to replace text from a list of files from find

Given the following find command: find . | xargs grep 'userTools' -sl How can I use sed on the results of that command? output: ./file1.ext ./file2.ext ./file3.ext
3
votes
2answers
1k views

How can I use sed to alter the results of find and pass the results to cp?

In solaris, I'd like to copy all files found by the find command to a slightly different path. The following script basically executes cp for each file found by find. For example: cp ...