Search Results

Search: Posts Made By: spacegoose
15,336
Posted By spacegoose
Script to find file types and info
I'm looking for a way to inventory files on a webserver into a CSV file, and am particularly interested in certain types of files, like .php, .cgi, .pl, .py, .sh, etc. but also want the ability to...
4,144
Posted By spacegoose
Thanks for the comments. I'm not understanding...
Thanks for the comments. I'm not understanding how the field 4 & 6 numbers are working -- how are these counted?

Assuming I have other lines in these files, will this replace those values too, or...
4,144
Posted By spacegoose
This seems to work great, thank you! Can you...
This seems to work great, thank you!

Can you explain how it's working?
4,144
Posted By spacegoose
Replace Stub Values In One Group Of Files With Actual Values From Another Group Of Files
I have two directories of files (new-config-files and old-config-files):

new-config-files/this-db/config.inc.php
new-config-files/that-db/config.inc.php
new-config-files/old-db/config.inc.php...
11,266
Posted By spacegoose
With nezabudka's gawk I get: gawk...
With nezabudka's gawk I get:


gawk '{u[$0]; l++} ENDFILE {print length(u), l, FILENAME; delete u; l=0}' * | sort -k1,1n
4 6 file1
5 7 file2


With yours I get:


gawk '{l[$0]++} ENDFILE...
11,266
Posted By spacegoose
FYI - Just tried this, it printed correct counts...
FYI - Just tried this, it printed correct counts but unique counts were off. I will check the others and update.



Thanks nezabudka!! This seems to work with gawk -- thanks also vgersh99 for...
11,266
Posted By spacegoose
Print number of lines for files in directory, also print number of unique lines
I have a directory of files, I can show the number of lines in each file and order them from lowest to highest with:

wc -l *|sort

15263 Image.txt
16401 reference.txt
40459 richtexteditor.txt...
3,499
Posted By spacegoose
Thanks RudiC -- that works, someone else...
Thanks RudiC -- that works, someone else suggested:

awk '{gsub("/","-",$NF)}1'

the same it appears except for spaces. Both work.

Can you say what's going on here? Looks like number of...
3,499
Posted By spacegoose
Replace characters after match
I have a file with lines like:

foo find "https://localhost" "/website/foo" "this/that/the/other" "yes/no/maybe" -u admin -p admin > yes/no/maybe.txt

I'd like to replace the slashes in the last...
Forum: Red Hat 03-17-2017
2,452
Posted By spacegoose
Thanks for the helpful suggestions Jim!
Thanks for the helpful suggestions Jim!
Forum: Red Hat 03-16-2017
2,452
Posted By spacegoose
Warn Before Executing Particular Command
I'm running CentOS 6.8 and use bash. I would like a warning to appear to the user who runs the command "service httpd restart"

E.g.
# service httpd restart
are you sure y/n
n
#
(or if y,...
Forum: Red Hat 03-16-2017
1,861
Posted By spacegoose
Warn Before Executing Particular Command
I'm running CentOS 6.8 and use bash. I would like a warning to appear to the user who runs the command "service httpd restart"

E.g.
# service httpd restart
are you sure y/n
n
#
(or if y,...
6,206
Posted By spacegoose
Bash ${PIPESTATUS[@]}
I'm using this form of variable setting to use the exit status of a pipeline e.g.



foo=$(date|grep -i thursday)$?
echo $foo
echo ${PIPESTATUS[@]}



or $foo later in a script.

On days...
Forum: IP Networking 03-07-2013
4,779
Posted By spacegoose
Thanks Corona688, that worked!
Thanks Corona688, that worked!
Forum: IP Networking 03-07-2013
4,779
Posted By spacegoose
Help with SSH tunnel?
I have a Java web app on machine (X) that needs to talk to an LDAP server (Y) on :636, but the LDAP server is only accessible on a particular network.

I can login to a machine (Z) on that network...
5,082
Posted By spacegoose
Escape
Thanks for the additional info, I'm not sure what to do with it unfortunately.

Is it the passwords in the passwords.csv file, or the matches of them in the found files (or both), that causes the...
5,082
Posted By spacegoose
Hi rdrtx1, This silences the error but does...
Hi rdrtx1,

This silences the error but does not cause the script to work / substitution to occur. The old password remains and is not substituted with the new.

Thanks,
Bill
5,082
Posted By spacegoose
Help with awk script (syntax error in regular expression)
I've found this script (http://stackoverflow.com/questions/648862/shell-script-search-and-replace-text-in-multiple-files-using-a-list-of-strings) which seems very promising to solve my issue:

To...
9,147
Posted By spacegoose
Thanks rdtx1, This looks promising, except...
Thanks rdtx1,

This looks promising, except the files I need to work on (e.g. somefile) are not delimited, they are free form database configuration files (see what my ggrep returns on an example...
9,147
Posted By spacegoose
Search & Replace: Multiple Strings / Multiple Files
I have a list of files all over a file system e.g.

/home/1/foo/bar.x
/www/sites/moose/foo.txtI'm looking for strings in these files and want to replace each occurrence with a replacement string,...
2,282
Posted By spacegoose
Thanks!
I use Bash on Solaris 10, OS X 10.6, or Red Hat Enterprise Linux 5 - if necessary.

tr '[:upper:]' '[:lower:]' | sort | uniq

was what I needed - from there it was pretty clear which were the...
2,282
Posted By spacegoose
Help with parsing mailbox folder list (identify similar folders)
List sample:

user/xxx/Archives/2010
user/xxx/BLARG
user/xxx/BlArG
user/xxx/Burton
user/xxx/DAY
user/yyy/Trainees/Nutrition interns
user/yyy/Trainees/Primary Care ...
2,576
Posted By spacegoose
Thanks Alister, The first example works...
Thanks Alister,

The first example works (thanks :), but the second one yields:

awk: syntax error near line 1
awk: illegal statement near line 1

I'm using Solaris.
2,576
Posted By spacegoose
Remove if the above line matches pattern
but keep if does not

I have a file: --> my.out

foo: bar
foo: moo
blarg
i am on vacation
foo: goose
foo: lucy
foo: moose
foo: stucky
groover@monkey.org
foo: bozo
grimace@gonzo.net...
Showing results 1 to 24 of 24

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