Having all that whitespace in the 'wrong' spot breaks the idea of
splitting words based on their being surrounded by whitespace. So get
rid of __all__ whitespace. Then use other logic find what you want.
E.g. if you want the 'word' following the 'word' processor, find the
first occurance of 'proc
On Wed, 2006-11-29 at 09:36 -0900, Ken Irving wrote:
> On Wed, Nov 29, 2006 at 02:32:37PM +, michael wrote:
> > I guess a complete rephrase is best.
> >
> > What I want is "how many processors does each WAITING job in lsf queues
> > require?". From 'bhist' I get outputs such as below (see whi
On Wed, Nov 29, 2006 at 02:32:37PM +, michael wrote:
> I guess a complete rephrase is best.
>
> What I want is "how many processors does each WAITING job in lsf queues
> require?". From 'bhist' I get outputs such as below (see whitespace
> anywhere in "num Processors") and cannot determine a
I guess a complete rephrase is best.
What I want is "how many processors does each WAITING job in lsf queues
require?". From 'bhist' I get outputs such as below (see whitespace
anywhere in "num Processors") and cannot determine a sure way of always
parsing it...
Thanks, Michael
EXAMPLES:
~/b
On Mon, 2006-11-06 at 01:10 +1100, John O'Hagan wrote:
> Or the whole thing could even be done with (I think!):
>
> #tr -d '\n' < IN | tr ' ' '\n' | grep -B1 Processor | grep -v 'Processor\|--'
>
> i.e., remove the newlines, replace all the spaces with newlines, then grep
> for
> the line befo
John O'Hagan wrote:
> On Thursday 09 November 2006 03:40, Andrew Sackville-West wrote:
>> SO I wonder what happened to the OP? Is he just watching waiting for
>> the right solution, or is he long gone?
> [...]
> OP? What OP? :)
The one who hopefully got an A for his answer.
--
Ste
On Thursday 09 November 2006 03:40, Andrew Sackville-West wrote:
> On Thu, Nov 09, 2006 at 12:52:57AM +1100, John O'Hagan wrote:
[...]
> >
> > while read i ; do
> >
> > if [[ $(echo "$i" | grep \\-\$ ) ]]; then
> >
> > i=$( echo "$i" | sed s/-\$//)
> >
On Thu, Nov 09, 2006 at 12:52:57AM +1100, John O'Hagan wrote:
> >
> > tr -d '-\n' >
> > | grep -v 'Processor\|--'
> >
>
> [...]
>
> Aha! You're right, my lines fail on the edge cases, and also when the target
> word is hyphenated.
>
> Your ingenious approach didn't always work either [1]; but
On Wednesday 08 November 2006 03:08, Andrew Sackville-West wrote:
> On Wed, Nov 08, 2006 at 02:51:20AM +1100, John O'Hagan wrote:
> > I tried this, and found that replacing the newlines with spaces stops the
> > grep from working because it puts spaces in the middle of any occurrences
> > of "Proce
On Tue, Nov 07, 2006 at 09:36:27AM -0900, Ken Irving wrote:
> On Tue, Nov 07, 2006 at 08:08:12AM -0800, Andrew Sackville-West wrote:
> > On Wed, Nov 08, 2006 at 02:51:20AM +1100, John O'Hagan wrote:
> > > ...
> > >
> > > Have we done this to death yet? :)
> >
> > there must be more. I haven't se
On Tue, Nov 07, 2006 at 08:08:12AM -0800, Andrew Sackville-West wrote:
> On Wed, Nov 08, 2006 at 02:51:20AM +1100, John O'Hagan wrote:
> > ...
> >
> > Have we done this to death yet? :)
>
> there must be more. I haven't seen any perl junkies provide us with
> some permutation of ($*^&*%^^@@Pro
On Wed, Nov 08, 2006 at 02:51:20AM +1100, John O'Hagan wrote:
>
> I tried this, and found that replacing the newlines with spaces stops the
> grep
> from working because it puts spaces in the middle of any occurrences
> of "Processor", but I see what you mean about the edge case. I think this
On Tuesday 07 November 2006 02:55, Andrew Sackville-West wrote:
> On Tue, Nov 07, 2006 at 01:00:34AM +1100, John O'Hagan wrote:
[...]
> > You're right; but the OP, Michael, gave the above scenario as his
> > problem. If your situation were the case, though, I guess we could use tr
> > -d '-' to g
On Mon, Nov 06, 2006 at 04:58:18PM -0800, Steve Lamb wrote:
> Douglas Tutty wrote:
> > Sometimes its too easy to keep trying to solve the wrong problem.
>
> True, but it sure does answer the question "How do you keep a programmer
> geek busy?" :)
>
If you want to keep busy, write this in as
Douglas Tutty wrote:
> Sometimes its too easy to keep trying to solve the wrong problem.
True, but it sure does answer the question "How do you keep a programmer
geek busy?" :)
--
Steve C. Lamb | But who decides what they dream?
PGP Key: 8B6E99C5 | And dream
With all the permutations, especially around possible hyphenations, it
starts to be easier to look at whatever is creating this hypothetical
silly hyphenated file. (note its the file thats silly, not the
hypothetical suggestion of hyphens).
Sometimes its too easy to keep trying to solve the wrong
On Sun, Nov 05, 2006 at 05:21:23PM +1100, John O'Hagan wrote:
> On Sunday 05 November 2006 16:42, John O'Hagan wrote:
> > On Sunday 05 November 2006 09:03, Ken Irving wrote:
> > > On Fri, Nov 03, 2006 at 09:56:12PM -0500, Douglas Tutty wrote:
> > > > On Fri, Nov 03, 2006 at 08:27:42PM +, michae
On Mon, Nov 06, 2006 at 07:55:02AM -0800, Andrew Sackville-West wrote:
> On Tue, Nov 07, 2006 at 01:00:34AM +1100, John O'Hagan wrote:
> > On Monday 06 November 2006 18:38, David Jardine wrote:
> > > On Mon, Nov 06, 2006 at 11:27:58AM +1100, John O'Hagan wrote:
> >
> > [...]
> >
> > > > E.g., if
On Tue, Nov 07, 2006 at 01:00:34AM +1100, John O'Hagan wrote:
> On Monday 06 November 2006 18:38, David Jardine wrote:
> > On Mon, Nov 06, 2006 at 11:27:58AM +1100, John O'Hagan wrote:
>
> [...]
>
> > > E.g., if IN contains:
> > >
> > > junk info 18 Pro
> >
> > But what if that line were:
> >
> >
On Tue, Nov 07, 2006 at 01:00:34AM +1100, John O'Hagan wrote:
> On Monday 06 November 2006 18:38, David Jardine wrote:
> > On Mon, Nov 06, 2006 at 11:27:58AM +1100, John O'Hagan wrote:
>
> [...]
>
> > > E.g., if IN contains:
> > >
> > > junk info 18 Pro
> >
> > But what if that line were:
> >
> >
On Monday 06 November 2006 18:38, David Jardine wrote:
> On Mon, Nov 06, 2006 at 11:27:58AM +1100, John O'Hagan wrote:
[...]
> > E.g., if IN contains:
> >
> > junk info 18 Pro
>
> But what if that line were:
>
> junk info 18 Pro-
>
> which seems more likely?
>
[...]
You're right; but the OP, Mi
On Mon, Nov 06, 2006 at 11:27:58AM +1100, John O'Hagan wrote:
> On Monday 06 November 2006 05:14, Andrew Sackville-West wrote:
> > On Sun, Nov 05, 2006 at 10:08:12AM -0800, Steve Lamb wrote:
> > > Andrew Sackville-West wrote:
> > > > On Mon, Nov 06, 2006 at 01:10:08AM +1100, John O'Hagan wrote:
> >
On Monday 06 November 2006 02:53, Andrew Sackville-West wrote:
> On Mon, Nov 06, 2006 at 01:10:08AM +1100, John O'Hagan wrote:
> > Or the whole thing could even be done with (I think!):
> >
> > #tr -d '\n' < IN | tr ' ' '\n' | grep -B1 Processor | grep -v
> > 'Processor\|--'
>
> nice.
>
I just can
On Monday 06 November 2006 05:14, Andrew Sackville-West wrote:
> On Sun, Nov 05, 2006 at 10:08:12AM -0800, Steve Lamb wrote:
> > Andrew Sackville-West wrote:
> > > On Mon, Nov 06, 2006 at 01:10:08AM +1100, John O'Hagan wrote:
> > >> Or the whole thing could even be done with (I think!):
> > >>
> >
On Monday 06 November 2006 05:29, Steve Lamb wrote:
> Andrew Sackville-West wrote:
> > tr -d '\n'
> >
> > deletes the new lines
>
> Ahhh, ok. Was still going off of the previous Python examples which
> didn't delete newlines, only replaced them with spaces. Mea Culpa.
Oops again! What I mean
On Sun, Nov 05, 2006 at 10:29:42AM -0800, Steve Lamb wrote:
> Andrew Sackville-West wrote:
> > tr -d '\n'
> >
> > deletes the new lines
>
> Ahhh, ok. Was still going off of the previous Python examples which
> didn't delete newlines, only replaced them with spaces. Mea Culpa.
>
I have to
Andrew Sackville-West wrote:
> tr -d '\n'
>
> deletes the new lines
Ahhh, ok. Was still going off of the previous Python examples which
didn't delete newlines, only replaced them with spaces. Mea Culpa.
--
Steve C. Lamb | But who decides what they dream?
PGP Key:
On Sun, Nov 05, 2006 at 10:08:12AM -0800, Steve Lamb wrote:
> Andrew Sackville-West wrote:
> > On Mon, Nov 06, 2006 at 01:10:08AM +1100, John O'Hagan wrote:
> >> Or the whole thing could even be done with (I think!):
>
> >> #tr -d '\n' < IN | tr ' ' '\n' | grep -B1 Processor | grep -v
> >> 'Proce
Andrew Sackville-West wrote:
> On Mon, Nov 06, 2006 at 01:10:08AM +1100, John O'Hagan wrote:
>> Or the whole thing could even be done with (I think!):
>> #tr -d '\n' < IN | tr ' ' '\n' | grep -B1 Processor | grep -v 'Processor\|--'
> nice.
Except for one problem. Look at the OP's post and y
On Mon, Nov 06, 2006 at 01:10:08AM +1100, John O'Hagan wrote:
> Or the whole thing could even be done with (I think!):
>
> #tr -d '\n' < IN | tr ' ' '\n' | grep -B1 Processor | grep -v 'Processor\|--'
>
nice.
A
signature.asc
Description: Digital signature
On Sunday 05 November 2006 17:21, John O'Hagan wrote:
> On Sunday 05 November 2006 16:42, John O'Hagan wrote:
> > On Sunday 05 November 2006 09:03, Ken Irving wrote:
> > > On Fri, Nov 03, 2006 at 09:56:12PM -0500, Douglas Tutty wrote:
> > > > On Fri, Nov 03, 2006 at 08:27:42PM +, michael wrote:
On Sunday 05 November 2006 16:42, John O'Hagan wrote:
> On Sunday 05 November 2006 09:03, Ken Irving wrote:
> > On Fri, Nov 03, 2006 at 09:56:12PM -0500, Douglas Tutty wrote:
> > > On Fri, Nov 03, 2006 at 08:27:42PM +, michael wrote:
>
> [...]
>
> > > > eg for
> > > >
> > > > junk info 18 Pro
>
On Sunday 05 November 2006 09:03, Ken Irving wrote:
> On Fri, Nov 03, 2006 at 09:56:12PM -0500, Douglas Tutty wrote:
> > On Fri, Nov 03, 2006 at 08:27:42PM +, michael wrote:
[...]
> > > eg for
> > >
> > > junk info 18 Pro
> > > cessor
> > >
> > > I wish to get the field '18'
[...]
> >
> > S
On Sat, Nov 04, 2006 at 01:03:14PM -0900, Ken Irving wrote:
> On Fri, Nov 03, 2006 at 09:56:12PM -0500, Douglas Tutty wrote:
> > On Fri, Nov 03, 2006 at 08:27:42PM +, michael wrote:
> > > I've been trying to do this with 'awk' but am hitting probs (not used
> > > awk for ages!) so all offers we
On Fri, Nov 03, 2006 at 09:56:12PM -0500, Douglas Tutty wrote:
> On Fri, Nov 03, 2006 at 08:27:42PM +, michael wrote:
> > I've been trying to do this with 'awk' but am hitting probs (not used
> > awk for ages!) so all offers welcome!
> >
> > Given a multiple line file, IN, that contains the w
On Fri, 2006-11-03 at 13:32 -0800, Aleksei Dzhulai wrote:
> The simplest case:
> awk '{for (i=1;i<=NF;i++) {if ($i~/Processor/) print $(i-1)} }' file
>
This doesn't work at all for me. Given the file:
BOF
junk info 18 Pro
cessor
EOF
It produces no output.
I think this should do what you want.
On Fri, Nov 03, 2006 at 08:27:42PM +, michael wrote:
> I've been trying to do this with 'awk' but am hitting probs (not used
> awk for ages!) so all offers welcome!
>
> Given a multiple line file, IN, that contains the word Processor
> (possibly split over 2 lines) I wish to output the field
michael wrote:
On Fri, 2006-11-03 at 13:32 -0800, Aleksei Dzhulai wrote:
The simplest case:
awk '{for (i=1;i<=NF;i++) {if ($i~/Processor/) print $(i-1)} }' file
I don't think that will pick up the case where the required output is on
the line before Processor, but thanks, M
I didn't catch
On Fri, 2006-11-03 at 13:32 -0800, Aleksei Dzhulai wrote:
> The simplest case:
> awk '{for (i=1;i<=NF;i++) {if ($i~/Processor/) print $(i-1)} }' file
>
I don't think that will pick up the case where the required output is on
the line before Processor, but thanks, M
--
To UNSUBSCRIBE, email to
The simplest case:
awk '{for (i=1;i<=NF;i++) {if ($i~/Processor/) print $(i-1)} }' file
"michael писал(а):
"
> I've been trying to do this with 'awk' but am hitting probs (not used
> awk for ages!) so all offers welcome!
>
> Given a multiple line file, IN, that contains the word Processor
> (pos
On Fri, Nov 03, 2006 at 08:27:42PM +, michael wrote:
> I've been trying to do this with 'awk' but am hitting probs (not used
> awk for ages!) so all offers welcome!
>
> Given a multiple line file, IN, that contains the word Processor
> (possibly split over 2 lines) I wish to output the field
41 matches
Mail list logo