I tried to parse data from switch configuration files
At first I parse interface number by device name and switch path with this command
Then I tried to get rate limit from interface that I parse from above with this command
But it is showing an error
If $INTERFACE is single number like "74" it will work but if $INTERFACE has forward slash like "1/13" it will showing an error as above. I have tried with put direct interface number and found that I have to put backslash before forward slash in interface number like this
I also tried with awk -v too but no luck. It is showing no error but still can't get value what I want
I tried with every possible changing quote and double quote but still no luck. Can someone help me this?
hi all i am trying to save an awk value into an array in bash:
total=`awk '{sum+=$3} END {print sum}' "$count".txt"`
((count++))
the above statement is in a while loop..
$count is to keep track of file numbers (1.txt,2.txt,3.txt,etc.)
i get the following error:
./lines1:... (1 Reply)
greetings all,
I am have a heck of a time trying to accomplish a very simple thing. I have an array of "shortname<spaces>id" created from a dscl output. I want to assign shortname=word1 and id=word2. I have tried
shortname=$(${textArray} | awk '{print $1}') - and get 'awk : cannot open... (3 Replies)
I would like to create a variable within my bash script using awk. I'm reading in a line from an external file, then outputting to a new file in a specific format. But, it doesnt quite work as I have expected and could use some help.
(A pertinent excerpt of ) the bash code is:
count=1
... (4 Replies)
I'm running a curl command in bash, but the & in the middle causes the second half of the line to run in the background, here's what I'm trying to do:
lat="37.451"
lon="-122.18"
url="http://ws.geonames.org/findNearestAddress?lat=$lat&lng=$lon"
curl -s "$url"
I tried escaping the & with \&,... (4 Replies)
Hi,
I'm trying to populate bash script variable, data_size with the
size of the largest file in my current directory
data_size=$(ls -lS | grep -v "total" | head -1) | awk '{ print $5 }'
I've tried adding an echo before the call to awk
data_size=$(ls -l | grep -v "total" | head -1) |... (2 Replies)
How to store escape character in the variable.
Var=abc,def,ghi,jkl
echo ${Var} | sed -e "s/,/|\\\\./g;s/^/\\\\./g"
\.abc|\.def|\.ghi|\.hjk
Var1=`echo ${Var} | sed -e "s/,/|\\\./g;s/^/\\\./g"`
Actual:
-------
echo $Var1
.abc|.def|.ghi|.jkl
Expected:
---------
echo $Var1... (4 Replies)
Hi everyone,
I'm trying to write a small script to automatize row data treatment. However, I got some trouble with the awk command.
I want to use awk to extract a define paragraph from a text file. The first and final lines are defined externally in two variables called debut and fin.
I... (2 Replies)
Hi,
I am new in bash scripting. In my work, I provide support to several users and when I connect to their computers I use the same admin and password, so I am trying to create a script that will only ask me for the IP address and then connect to the computer without having me to type the user... (5 Replies)
Debian 9 64x - LXDE
How can i disable escape sequences in a variable?
#!/bin/bash
#mainscript
. "./links.bash"
echo "$red_start This text should be red $color_end"#!/bin/bash
#links.bash
#colors
red_start="\eOutput that i get:
\e
Output expected:
This text should be... (5 Replies)
Hello,
I need to split a file into two of different locations by re-direction in awk.
cat infle
aaa 1 3
bbb 2 4
aaa 3 3
bbb 4 4
aaa 5 3
bbb 6 4
cat /storage/tmp/group_a.gtf
aaa 1 3
aaa 3 3
aaa 5 3
cat /storage/tmp/group_b.gtf
bbb 2 4
bbb ... (2 Replies)
Discussion started by: yifangt
2 Replies
LEARN ABOUT FREEBSD
etherswitchcfg
ETHERSWITCHCFG(8) BSD System Manager's Manual ETHERSWITCHCFG(8)NAME
etherswitchcfg -- configure a built-in Ethernet switch
SYNOPSIS
etherswitchcfg [-f control file] info
etherswitchcfg [-f control file] config command parameter
etherswitchcfg [-f control file] phy phy.register[=value]
etherswitchcfg [-f control file] port%d [flags] command parameter
etherswitchcfg [-f control file] reg register[=value]
etherswitchcfg [-f control file] vlangroup%d command parameter
DESCRIPTION
The etherswitchcfg utility is used to configure an Ethernet switch built into the system. etherswitchcfg accepts a number of options:
-f control file
Specifies the etherswitch(4) control file that represents the switch to be configured. It defaults to /dev/etherswitch0.
-m When reporting port information, also list available media options for that port.
-v Produce more verbose output. Without this flag, lines that represent inactive or empty configuration options are omitted.
config
The config command provides access to global switch configuration parameters. It support the following commands:
vlan_mode mode Sets the switch VLAN mode (depends on the hardware).
phy
The phy command provides access to the registers of the PHYs attached to or integrated into the switch controller. PHY registers are speci-
fied as phy.register, where phy is usually the port number, and register is the register number. Both can be provided as decimal, octal or
hexadecimal numbers in any of the formats understood by strtol(3). To set the register value, use the form instance.register=value.
port
The port command selects one of the ports of the switch. It supports the following commands:
pvid number Sets the default port VID that is used to process incoming frames that are not tagged.
media mediaspec
Specifies the physical media configuration to be configured for a port.
mediaopt mediaoption
Specifies a list of media options for a port. See ifconfig(8) for details on media and mediaopt.
And the following flags (please note that not all flags are supported by all switch drivers):
addtag Add VLAN tag to each packet sent by the port.
-addtag
Disable the add VLAN tag option.
striptag
Strip the VLAN tags from the packets sent by the port.
-striptag
Disable the strip VLAN tag option.
firstlock
This options makes the switch port lock on the first MAC address it sees. After that, usually you need to reset the switch to learn
different MAC addresses.
-firstlock
Disable the first lock option. Note that sometimes you need to reset the switch to really disable this option.
dropuntagged
Drop packets without a VLAN tag.
-dropuntagged
Disable the drop untagged packets option.
doubletag
Enable QinQ for the port.
-doubletag
Disable QinQ for the port.
ingress
Enable the ingress filter on the port.
-ingress
Disable the ingress filter.
reg
The reg command provides access to the registers of the switch controller.
vlangroup
The vlangroup command selects one of the VLAN groups for configuration. It supports the following commands:
vlan VID Sets the VLAN ID (802.1q VID) for this VLAN group. Frames transmitted on tagged member ports of this group will be tagged with
this VID. Incoming frames carrying this tag will be forwarded according to the configuration of this VLAN group.
members port,...
Configures which ports are to be a member of this VLAN group. The port numbers are given as a comma-separated list. Each port
can optionally be followed by ``t'' to indicate that frames on this port are tagged.
FILES
/dev/etherswitch? Control file for the Ethernet switch driver.
EXAMPLES
Configure VLAN group 1 with a VID of 2 and make ports 0 and 5 its members while excluding all other ports. Port 5 will send and receive
tagged frames while port 0 will be untagged. Incoming untagged frames on port 0 are assigned to vlangroup1.
# etherswitchcfg vlangroup1 vlan 2 members 0,5t port0 pvid 2
SEE ALSO etherswitch(4)HISTORY
etherswitchcfg first appeared in FreeBSD 10.0.
AUTHORS
Stefan Bethke
BSD September 20, 2013 BSD