How to replace a string in multiple files in Linux command line

I need to replace a string in a lot of files in a folder, with only ssh access to the server. How can I do this?

Source: How to replace a string in multiple files in linux command line – Stack Overflow

1 thought on “How to replace a string in multiple files in Linux command line

  1. 1) You can use the ‘replace’ utility that comes with MySQL.

    2) You can use the ‘sed’ utility as follows:

    # create a couple of test files
    $ for i in 1 2 3; do printf ‘file %d\n’ $i >f$i; done

    # show the contents
    $ cat f[123]
    file 1
    file 2
    file 3

    # change the files
    $ sed –expression=s/file/FILE/g –in-place f[123]

    # show the contents
    $ cat f[123]
    FILE 1
    FILE 2
    FILE 3

    # clean up
    $ rm f[123]

Comments are closed.