Search Results

Search: Posts Made By: dannyvdberg
1,017
Posted By CarloM
linenumber=16 sed "${linenumber}s/$/sometext/"...
linenumber=16
sed "${linenumber}s/$/sometext/" file
will append sometext to line 16 of file.

EDIT: If you want to edit the file inplace then check if your sed supports -i. If not then you'll...
1,017
Posted By Scott
You can do it with sed. i.e. sed "16i\ ...
You can do it with sed. i.e.

sed "16i\
newline goes here
" /etc/sudoers


EDIT: -i (if the option is available) will overwrite the original file. Always take a backup first!
EDIT 2: LOL...
2,431
Posted By RudiC
Not knowing what shell you use, here's a bash...
Not knowing what shell you use, here's a bash proposal:
tar_gz=( $(find @etc@apache2...) )
[ ${#tar_gz[@]} -ne 5 ] && { echo "file set incomplete"; exit 1; }
for FN in ${tar_gz[@]}; do ... ; done
2,431
Posted By RudiC
If tar_gzholds more than one file name, the...
If tar_gzholds more than one file name, the expression fails, as it has "too many arguments". Make sure to work on one file at a time, e.g. by using a for loop or similar.
902
Posted By Subbeh
You only want to show the directories? In that...
You only want to show the directories? In that case you can use
find /restore/configuration/ -name configuration_backup* -type d
1,605
Posted By RudiC
... and even more effective were the single...
... and even more effective were the single readIFS=":" read X X USERID GROUPID X HOMEID SHELLID < <(grep $USER /etc/passwd)
1,605
Posted By MadeInGermany
Run the following UUOC killer on your script: ...
Run the following UUOC killer on your script:
sed 's/\<cat \([^ ][^ ]* *\)| *\([^{(]\)/ < \1\2/' yourscript > newscriptand see the result with
diff yourscript newscript:cool:
1,689
Posted By sea
I'd rather make it english output first than add...
I'd rather make it english output first than add a handler for yum/apt-get...

Either way:
Very nice approach, for future, try to make each function just to that single thing it should.
Make...
Showing results 1 to 8 of 8

 
All times are GMT -4. The time now is 09:07 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy