replace a line in files present in different folders shell script
NickName:rpav Ask DateTime:2017-11-30T13:22:56

replace a line in files present in different folders shell script

I have a common line in different files present in different folders. how can i replace that line with some other line using shell script sed command in all the files of the folders ?

Eg: t="/home/file.txt" present in one of the file in a folder same line is present in different file of differnt folder

I have to replace it with t="/desk/file1.txt" . so where can i execute the sed command whether outside the folder ?

Copyright Notice:Content Author:「rpav」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/47566414/replace-a-line-in-files-present-in-different-folders-shell-script

More about “replace a line in files present in different folders shell script” related questions

replace a line in files present in different folders shell script

I have a common line in different files present in different folders. how can i replace that line with some other line using shell script sed command in all the files of the folders ? Eg: t="/home...

Show Detail

How to list all the files using shell script present in a specific folder under all the directories those are present in the root directory?

I want to list all the files that are present in a specific folder under all the present directories present in my root directory. Say my root directory is . and there multiples folders like a1,b1,...

Show Detail

Writing shell script to scan a list of folders

I have a file folders.txt one two three four ... that has a list of folder names. [one, two, three and four are names of folders]. Each of these folders has a number of files of different types (

Show Detail

Shell Script for comparing two folders

I want to write a shell script to compare two folders and save the difference in a different folder. Suppose FolderA has five sub folders as A1,A2,A3,A4,A5 and FolderB has five sub folders as A1,...

Show Detail

How to search and replace a content of a file using shell script?

I have started learning shell scripting a few days ago. My scenario is, i have to search and replace a content which exists in different lines in a file using shell script. For Example, I have men...

Show Detail

simple shell script to copy files and folders and also execute a command

I haven't written any Shell scripts before, but i have to write a simple shell script to do the following; I will keep all the required files in a single folder and bundle it with this shell scrip...

Show Detail

how to write shell script to copy files in the same directory where the script is present

I am running a shell script say xyz.sh. This shell script need to copy all files present in the same directory where this script is present to some another folder. Is there any way to do that?

Show Detail

FTP files in different folders using shell script

I'm trying for an ftp script, that sends files in different folders within the same connection, but no luck with below script. #!/bin/bash HOST_NAME=host.server username= user_name passwd= pas...

Show Detail

Shell Script to Run a python code with two different folders of The Same Numbered Files

I have two folders and each contains files that has same numbering systems which is part of the file name. For example, Folder 1 has: 001file_read.txt, 002file_read.txt, until 650file_read.txt

Show Detail

Compare the files in two folders using a shell script

I want to compare two folders to see if the file inside are the same or not. If it is the same then I moved those files into another folder. For example: f1 f2 ------ ...

Show Detail