Search Results

Search: Posts Made By: alan
1,697
Posted By alan
Grep and substitute?
I have to parse ASCII files, output the relevant data to a comma-delimited file and load it into a database table.

The specs for the file format have been recently updated and one section is...
1,518
Posted By alan
grep -Rn '^exit 0' *.ksh | grep ':1:\|:2:' ...
grep -Rn '^exit 0' *.ksh | grep ':1:\|:2:'

did the trick. What it does is:


grep -R (recursive)
grep -n (print line number)
grep '^exit 0' (exit 0 at beginning of line only)
grep...
1,518
Posted By alan
I must be doing something wrong $ find ....
I must be doing something wrong

$ find . -name "*.ksh" -type f -exec awk '(FNR<3) && /^exit 0/{ print FILENAME }' '+'

This gives me find: missing argument to `-exec'

I tried with the semi...
1,518
Posted By alan
Best way to parse 1000 scripts for a string?
I have inherited code from a former employee and I need to identify the scripts he disabled with exit 0 at the top.

After *many* trials and errors, I finally got this to work

alan@p33 => find ....
3,778
Posted By alan
Neo, thank you. It seems like a much easier...
Neo, thank you. It seems like a much easier solution to implement for a n00b like me. A buddy suggested using PAM with sudo but to be honest, it is a bit out of my league.
3,778
Posted By alan
Why do they need sudo? Unknown...this was setup...
Why do they need sudo? Unknown...this was setup that way before I joined this team.

The majority of the users do create and mod ksh scripts which can affect database processes as well as data....
3,778
Posted By alan
Sudoers for one day per week?
I have been volunteered by my boss to be the sysadmin for our production redhat server. He asked me to tighten the security to avoid mishaps like "rm -f *" that occured not long ago.

Right now,...
2,743
Posted By alan
Yes, I do want to sort the whole file name. ...
Yes, I do want to sort the whole file name.

I tried to do that by using "|sort" instead of "sort -k..." but the problem remains.
2,743
Posted By alan
Why is sort -k not working all the time?
I have a script that puts a list of files in two separate arrays:

First, I get a file list from a ZIP file and fill `FIRST_Array()` with it. Second, I get a file list from a control file within a...
1,904
Posted By alan
This did the trick: Thanks for taking...
This did the trick:



Thanks for taking the time.
1,904
Posted By alan
Prevent word splitting with file with spaces in name
Hello,

I have a script that "validates" a ZIP file that look like this

AAA_20120801.zip =>
x~back end~20120801.TXT
y~time in~20120801.TXT
z~heat_chamber~20120801.TXT
AAA_20120801.ctlMy...
2,842
Posted By alan
Array in awk outputs multiple values
Disclaimer: OP is 100% Awk beginner.

I use this code on ASCII files I need to report against.


awk 'BEGIN {
tokens["Model"] = 0
tokens["Manufacturer"] = 0
...
4,660
Posted By alan
sendmail: trusted-users or aliases?
For a project that I have been assigned to, I need to send emails to a business partner (business_partner.com) from one production server. However, my emails neither reach their destination nor...
2,431
Posted By alan
Cool. I changed to a while loop and fed $myfile...
Cool. I changed to a while loop and fed $myfile to the awk command. It worked. Thank you.
2,431
Posted By alan
pass shell parameters to awk does not work
Why does this work

for myfile in `find . -name "R*VER" -mtime +1`
do
SHELLVAR=`grep ^err $myfile || echo "No error"`
ECHO $SHELLVAR
done

and outputs

No...
3,198
Posted By alan
Thanks for taking the time. With a couple of...
Thanks for taking the time. With a couple of friends, this is what we got

find . -name "R*VER" -exec sh -c 'grep -H ^err "{}" || echo "{}:No error"' \; |
awk -F: '
BEGIN...
1,164
Posted By alan
find . -name "R*VER" -exec sh -c 'grep -H ^err...
find . -name "R*VER" -exec sh -c 'grep -H ^err "{}" || echo "{}:No error"' \; |
awk -F: '
BEGIN { q="\047" }
{
file=$1
...
3,198
Posted By alan
Wrap lines with awk to create SQL script
Greetings!

Some of my files list hardware errors (we test electronic components), some have none. If the file name has no errors, I still want to display a message like "No error", else I display...
1,164
Posted By alan
After running the command find . -name...
After running the command

find . -name "R*VER" -mtime +1 -exec sh -c 'grep -H ^err "{}" || echo "{}:No error"' \;

my files look like this

...
1,164
Posted By alan
Grep: Return a user message when no hits
I have ASCII files to parse that 48 hours old or more ; I can identify them like so

find . -name "FILE*TXT" -mtime +1 -exec ls -ltas '{}' ';'

Some files have a list of hardware errors...
1,164
Posted By alan
Both suggestions worked great! I don't even have...
Both suggestions worked great! I don't even have to add a newline after the PowerOnHours field (no added value, really). Your solution with bash is very straightforward, perfect for my big files.
...
1,164
Posted By alan
Sed wraps some lines, not all
Greetings. I am using SED to cleanup files that are laid out like so:


ReceiverID=028936004663
SerialNumber=WD-WCAV95708405
Currenttemp=44C
PowerOnHours=3663h
ReceiverID=028923894902...
Forum: Programming 03-08-2011
2,041
Posted By alan
1) Google search URL => sybase equivalent for...
1) Google search
URL => sybase equivalent for oracle decode - Google Search (http://www.google.com/search?client=ubuntu&channel=fs&q=sybase+equivalent+for+oracle+decode&ie=utf-8&oe=utf-8)

Answer...
1,997
Posted By alan
Go this one working with decent results find...
Go this one working with decent results

find . -name "*.VER" -exec egrep -A 1 'Test_Version=|Model-Manufacturer:' {} ';'

I need to figure out how to wrap output lines up...
1,997
Posted By alan
Actually, I must find both expressions. My...
Actually, I must find both expressions. My apologies if I wasn't clear.

Does grep have an AND feature?
Showing results 1 to 25 of 88

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