Hot answers tagged

6

Try this: sed 's/yyyymmdd/YYYYMMDDHH24MISS/g' filename > changed.txt Or, to keep the same filename: sed 's/yyyymmdd/YYYYMMDDHH24MISS/g' filename > changed.txt && mv changed.txt filename


3

Here is a solution built around the inotifywait utility. (You could use incron too, but you'd still need code similar to this.) Run this at boot time, for example from /etc/rc.local. #!/bin/bash # cd /path/to/samba/folder # Rename received files to this prefix and suffix prefix="some_prefix" suffix="pdf" inotifywait --event close_write --format "%f" ...


2

Type lsblk: > lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 111,8G 0 disk ├─sda1 8:1 0 1020K 0 part ├─sda2 8:2 0 41G 0 part ├─sda3 8:3 0 11G 0 part ├─sda4 8:4 0 19G 0 part / ├─sda5 8:5 0 33,6G 0 part ├─sda6 8:6 0 2G 0 part ├─sda7 8:7 0 2G 0 part └─sda8 8:8 0 ...


2

Your sed command only sends its result to the standard output. You would have to redirect it in a subsequent command (NOT in the same command, like sed 'sedcommand' file > file, as this would erase the file before processing it). You also can pipe the commands to ed instead of using sed : for file in $filelist ; do echo -e ...


2

You have created an "infinite loop" with a softlink that points to itself. You may have mixed up the arguments to ln. Since the second argument to ln is an existing directory, it will create a softlink with the same "base name" as the first argument, inside that directory. So you create a softlink ROOT which points to ROOT. When trying to resolve this you ...


2

Your file stills there. You only changed the file's path and name since you only execute mv and not rm command. Your original file must be in /fullchain.pem. You moved the fullchain.pem file from its original path /etc/letsencrypt/live/fullchain.pem to / that's why you can't see it any more in the main. Just execute $ mv /fullchain.pem ...


2

Since you're trying to match the first 30 lines of your files you could save the text in a file e.g. ref_file then use diff to compare the reference file with the first 30 lines in each file: find . -name "*.[ch]" -exec ./myscript {} \; -print where ./myscript is #!/bin/sh head -n 30 "$1" | diff - /path/to/ref_file >/dev/null so -print in the first ...


2

You could find each file to be processed using find and feed each filename to a script made on purpose to look for a match and print the filename in case of a match; I'd suggest to use a script rather than a one-liner for the added easiness of handling the multi-line string compared to the prompt. That is: find . -name "*.[ch]" -exec /path/to/script {} \; ...



Only top voted, non community-wiki answers of a minimum length are eligible