Search Results

Search: Posts Made By: Bubnoff
8,527
Posted By Bubnoff
You rock!! Three ways to do this ...one...
You rock!!

Three ways to do this ...one record based ( record as defined by input file ) and two essentially line/field based.

Thanks again!

Bub
8,527
Posted By Bubnoff
Nice solutions but how do they work? awk -F:...
Nice solutions but how do they work?
awk -F: '/=/ { print x } NF > 2 { printf "%s", $0; next } { printf "%s", $2 }' infile
I get the NF > 2 { ...etc and after but why does the /=/ {print x}
work?...
8,527
Posted By Bubnoff
Thanks Radoulov ~ However, it's still...
Thanks Radoulov ~

However, it's still printing the first record incorrectly. Here's what I need:
Tue Aug 11 20:17:01 PDT 2009 295 42.1428
Tue Aug 18 20:17:01 PDT 2009 294 42.0000 ...
8,527
Posted By Bubnoff
Awk; gsub in fields 3 and 4
I want to transform a log file into input for a database.

Here's the log file:
Tue Aug 4 20:17:01 PDT 2009
Wireless users: 339
Daily Average: 48.4285
=
Tue Aug 11 20:17:01 PDT 2009
Wireless...
3,695
Posted By Bubnoff
[UPDATE - SOLVED - See updates at bottom.] ...
[UPDATE - SOLVED - See updates at bottom.]

Thanks John, however, I still get the blank line on line one.
Here's the output ( excerpt of top ) via:
cat -n test.sh | headOutput:

1
...
3,695
Posted By Bubnoff
Thanks for the replies. I tried adding dnl both...
Thanks for the replies. I tried adding dnl both in the macro and in the file and I still end up with one blank line at the top.

However, the resulting scripts work and if it really bothers me I...
3,695
Posted By Bubnoff
Thanks, I think I'm getting close -- down to one...
Thanks, I think I'm getting close -- down to one blank line.

I found references to this idiosyncrasy online.

Bub
3,695
Posted By Bubnoff
This does help -- thanks. Where is this...
This does help -- thanks. Where is this documented? I've been looking and haven't seen any examples where the defines were ended this way. I assume you mean:

define(`START_SCRIPT',`#!/bin/bash...
3,695
Posted By Bubnoff
m4 adds extra space at top of file.
I have used m4 in the past to generate source code where aesthetics and space were of no consequence [ provided it worked ]. Now I am using it to generate script and program templates [ in an effort...
3,063
Posted By Bubnoff
m4
It doesn't matter what extension you use, but vim recognizes
'.m4'. So, for the purposes of getting syntax highlighting, I'd use the extension 'm4'.

Not sure what you mean by plugins, unless you...
6,946
Posted By Bubnoff
I understand the command-substitution construct...
I understand the command-substitution construct $(), but was thrown by the "cat". It makes perfect sense now that I've had a chance to think about it. I was not connecting execution of the script...
6,946
Posted By Bubnoff
As it turns out ...yes! It works ...but how? I...
As it turns out ...yes! It works ...but how? I "get" the $() and quoting construct but am wondering how this executes.
This isn't documented anywhere I looked. EDIT: Yes, I know that ssh executes...
6,946
Posted By Bubnoff
That'd work except there's a lot of machines to...
That'd work except there's a lot of machines to go through.

I wanted to do something to the effect:
for i in {10..55};do ssh root@10.10.18.$i < hours.sh;done

I don't exactly know what the...
6,946
Posted By Bubnoff
How would I get the script to catch my keyboard...
How would I get the script to catch my keyboard input with read when run remotely?

I've tried the '-t' and '-T' options to ssh with no success.
6,946
Posted By Bubnoff
Remote script skips "read" command
This script is supposed to display a file ( crontab ), ask the user if they wish to update the file, then it goes through an update routine.

#!/bin/bash
FILE=/etc/crontab

tail -5 $FILE
...
12,612
Posted By Bubnoff
Some of the locations have two words ...east...
Some of the locations have two words ...east this, or grand that, blah-blah
city. The tab is essential. This is one reason I was asking about the possibilities for sourcing the file with some...
12,612
Posted By Bubnoff
Awesome, thanks!
Awesome, thanks!
12,612
Posted By Bubnoff
Like this? while IFS=$'\t' read -r b c ...
Like this?

while IFS=$'\t' read -r b c

Is there a better way to indicate the value of IFS? I had
issues simply going:

IFS=\t

Thanks!

Bub

PS: It's working ...just wondering about...
12,612
Posted By Bubnoff
reading configuration files in bash. Best way?
Context:
I have a random pin number generator script that reads a tab-delimited file containing a location and a count:

eg.,
mansfield 30
tokyo 15
smithville 34It produces...
29,188
Posted By Bubnoff
vgersh99 ~ The input file looks like: ...
vgersh99 ~

The input file looks like:
dador,173323,bpt,jsp,39030013338878,1
dador,173323,brew,jsp,39030013338860,b
dador,173323,brew,jsp,39030013339447,b
dador,173323,brew,jsp,39030013339538,b...
29,188
Posted By Bubnoff
@vgersh99 Thanks, that works! Is it...
@vgersh99

Thanks, that works!

Is it possible to add other arrays in the same statement, using the unique
field like before?

Sample output ( headings added to clarify objective ):...
29,188
Posted By Bubnoff
This is very close! This is what I used: BEGIN...
This is very close! This is what I used:
BEGIN {
FS=","
}
{
c2[$2]=(c2[$2])?c2[$2] FS $3:$3
}
END {
for (i in c2)
printf("<tr>\n<td>%s</td><td>%s</td>\n</tr>\n", i, c2[i])
}And I...
29,188
Posted By Bubnoff
Another question
This is what I've got and it seems to work.

ELEMENTS2=${#ARRAY2
}

cols=5
rows=$((ELEMENTS2/cols+1))

printf "Rows = $rows\n"
printf "Elements = $ELEMENTS2\n"

for (( row=1; row<=rows;...
29,188
Posted By Bubnoff
Rock and Roll!!! Thanks tukuyomi! Bub
Rock and Roll!!!

Thanks tukuyomi!

Bub
29,188
Posted By Bubnoff
Thanks for your response! While each row...
Thanks for your response!

While each row should contain a defined number of fields/elements,
the actual amount of rows is dependent on the length of the array.

So I'm thinking rows would need...
Showing results 1 to 25 of 47

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