Search Results

Search: Posts Made By: popeye
9,180
Posted By popeye
thanks ..
thanks ..
9,180
Posted By popeye
Bash : Parameter expansion ${var:-file*}
Example data

$ ls *somehost*
10.10.10.10_somehost1.xyz.com.log
11.11.11.11_somehost2.xyz.com.log



#!/bin/bash
#FILES="*.log"
FILES=${FILES:-*.log}

for x in $FILES
do
ip="${x%%_*}"...
2,683
Posted By popeye
Regular Expressions : grab flash devices
I know its an art and it takes a little time .. but is there a better way to do this ?

(sup-)?boot(disk|flash)|flash\d*|disk\d



Thanks in advance
Pop
2,440
Posted By popeye
Using sed to extract line of a file
Ok .. This is driving me nuts. I suppose I need another set of eyes.

Example Data

interface Vlan1
description xxxxxxxxxxxx
ip address 192.168.1.1 255.255.255.252
no ip redirects
no ip...
4,646
Posted By popeye
Thanks fellas .. Centos linux .. and I am using...
Thanks fellas .. Centos linux .. and I am using the -d .. but that doesnt give me much info related to using an "OR"
4,646
Posted By popeye
Tcl / expect need to attempt telnet if failed ssh
Morning and Happy New Year to all.

I am in a situation where I need to connect to a list of devices that are using either telnet or ssh.
I want to try to telnet, if I receive any of the...
1,443
Posted By popeye
Vi / vim - Insert a external command response
I would like to execute and external command and insert it into a particular area of the file I am editing. Note that I have the ORIGINAL AT&T vi training doc dated 1987. Doesnt explain it.

As an...
1,781
Posted By popeye
qiven the quoted source in my original post ...
qiven the quoted source in my original post

The output could be

It is matched because 4 instances of "Normal" were found.

or it could be
because only 3 instance of "Normal" were found.
1,781
Posted By popeye
BASH - Regular Expressions :Looking for one word on multiple lines.
Im looking for a bash solution that will use Regular Expressions (not perl, sed or awk) to check the example data below and then give me a status.
which would be just simply Match or Mismatch.

...
20,294
Posted By popeye
Pipe to basename
I would like to use basename with wc .. I know I can use awk, but want to use basename.

Change this

wc -l txt*
106 /home/popeye/txt1
154 /home/popeye/txt2
159 /home/popeye/txt3
420 total
...
3,122
Posted By popeye
DOPEY !!!! I stripped down everything that wasnt...
DOPEY !!!! I stripped down everything that wasnt really needed for the forum and posted.

I grabbed the script lines I posted on the forum and ran that on the work VM. Worked fine but still...
3,122
Posted By popeye
Im editing with vi. Ive :set list and dont see...
Im editing with vi. Ive :set list and dont see any extraneous items in the script files on the VMPLAYER VMs. I will also double quoted all the vars when I get to the case. Yep. At the time I was...
3,122
Posted By popeye
VERY INTERESTING ! Ive tried this on a VM...
VERY INTERESTING !

Ive tried this on a VM at school, a Ubuntu VM on my latptop and a Centos VM on my laptop.

What happens on all is that as I run through and test each option, at one point...
3,122
Posted By popeye
Bash : While Loop behavior
Good Morning

I think there may be something I dont understand fully.

The following code works well, but I dont like the set domen method.


#!/bin/bash
#
domen="y"
while [ "$domen" ==...
2,147
Posted By popeye
Sorry fellas, Being in the expert bucket I...
Sorry fellas,

Being in the expert bucket I figured you guys would "see" it. ... and if you execute the script I provided you will see that it actually works and the desired output is shown. No...
2,147
Posted By popeye
BASH Internal : Replace pattern with string without external command
Morning,
I'm trying step up my scripting game .. :rolleyes::confused::D

Is there a way to do the replacement with an or without using an external command ?

I did try but no joy.

...
9,527
Posted By popeye
TCL - quotes inside a string assigned to a var
I know that

set line "This is a line."



puts whats between " inside the var line.

But

How do I do the same for

set line "This is a line "with quotations" inside the string."
7,000
Posted By popeye
Redirect output to memory instead of an external file
I use the following as an example. I find myself always doing this and I believe my scripts would run much faster if I put the sed results into a place in memory rather than writing to files. Again,...
2,241
Posted By popeye
ksh Loop through file one, remove lines from file two
Good Afternoon,


I start with a file named biglist.txt.
I have another file smallerlist. txt

I want to remove the lines from smallerlist.txt from biglist.txt and leave those lines that do...
2,313
Posted By popeye
BASH- Hold script until all contents of a file is written
I have to hit a very large database to pull fields of information.

I have a script that runs multiple instance of the same query against the data base and writes contents to a file.

The...
8,185
Posted By popeye
Expect : appending to log_file $my.log
Inside a script, I defind a log file.

log_file -a $x.log

My question is :

Shown for illustration - this doesnt actually work -- Is there a way to

puts "this is appended text" $x.log
...
1,160
Posted By popeye
Sweet !! That was exactly what I was looking for...
Sweet !! That was exactly what I was looking for ... simple easy to understand.

Thanks again !!
1,160
Posted By popeye
[Solved] Shell : Can someone show me how to used these ?
${var%pattern}
removes the shortest suffix of $var patching pattern
${var%%pattern}
removes the longest suffix of $var patching pattern
${var#pattern}
removes the shortest prefix...
3,817
Posted By popeye
ksh sed - Extract specific lines with mulitple occurance of interesting lines
Data file example



I look for primary and * to isolate the interesting slot number.



slot=`sed '/^primary$/,/\*/!d' filename | tail -1 | sed s'/*//' | awk '{print $1" "$2}'`



Now...
1,936
Posted By popeye
Thanks to all for the input. Using...
Thanks to all for the input.

Using (basiclly) sea's solution.
No ... this isnt homework.


This did bring up another question. Ill post in different thread.

Thanks again to all .. this...
Showing results 1 to 25 of 101

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