Visit Our UNIX and Linux User Community

Search Results

Search: Posts Made By: popeye
5,180
Posted By popeye
thanks ..
thanks ..
5,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%%_*}"...
1,665
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
876
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...
2,390
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"
2,390
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...
794
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...
863
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.
863
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.

...
12,149
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
...
1,757
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...
1,757
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...
1,757
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...
1,757
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" ==...
1,211
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...
1,211
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.

...
3,800
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."
4,103
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,...
1,542
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...
1,746
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...
5,188
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
...
759
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 !!
759
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...
1,520
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,228
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

 

Featured Tech Videos

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