Negating awk command

I would like to find out how to negate my nawk command.
This pulls all files with <TITLE> in the file:
#!/bin/ksh
find . \( -name "*.htm" -o -name "*.html" \) -print |
xargs awk '/<TITLE>/ {printf("%s\t%s\n", FILENAME, $0)}'
OUTPUT:
./fir.html <TITLE> fir title </TITLE>
./tr.html <TITLE> third title </TITLE>
./four.html <TITLE> four title </TITLE>
I tried several ways to pull up files with no <TITLE> in the file:
#!/bin/ksh
find . \( -name "*.htm" -o -name "*.html" \) -print |
xargs awk '!/<TITLE>/ {printf("%s\t%s\n", FILENAME, $0)}'
and tried this with no luck:
#!/bin/ksh
find . \( -name "*.htm" -o -name "*.html" \) -print |
xargs awk '$2 !~ /<TITLE>/ {printf("%s\t%s\n", FILENAME, $0)}'
Both did not work.
Any suggestions???

Hi,
I tried your first script and it worked fine for me.
I noticed that these are script files rather than commands - is it possible you are executing something else in your path?
Can you provide a little more detail?
Thanks,
     -Steve

Similar Messages

  • Highlight dates in cal output with awk.

    Lately I've stumbled across a problem (read: I had a stupid idea and now really want to make it happen) where I wanted to highlight significant dates in the terminal calendar cal. now I have a "working solution" which highlights the dates, however it's got two major issues:
    1) It's ugly, as in unreadably ugly which can probably be improved with more expertise.
    2) It requires me to add another pipe and awk statement for every date I want to highlight
    what I was hoping to find out is if I could somehow incorporate a loop to run through the pipe with different values each time, it seems simple in theory but in practice it falls apart on me, so is it at all possible?
    My command currently looks like this:
    cal -y | awk -v month="`date +%m`" -v day="`date +%e` " '{m=int((NR-3)/8)*3+1; for (i=0;i<3;i++) {t=substr($0,1+i*22,20) " "; if (m+i==month) sub(day,"\033[0;31m&\033[0m",t);} print t[0],t[1],t[2];}' | awk -v month="10" -v day="31 " '{m=int((NR-3)/8)*3+1; for (i=0;i<3;i++) {t=substr($0,1+i*22,20) " "; if (m+i==month) sub(day,"\033[0;31m&\033[0m",t);} print t[0],t[1],t[2];}' | awk -v month="04" -v day="25 " '{m=int((NR-3)/8)*3+1; for (i=0;i<3;i++) {t=substr($0,1+i*22,20) " "; if (m+i==month) sub(day,"\033[0;31m&\033[0m",t);} print t[0],t[1],t[2];}' | awk -v month="02" -v day="14 " '{m=int((NR-3)/8)*3+1; for (i=0;i<3;i++) {t=substr($0,1+i*22,20) " "; if (m+i==month) sub(day,"\033[0;31m&\033[0m",t);} print t[0],t[1],t[2];}'
    and I was hoping to figure out a way to achieve the form:
    cal -y | for i in `date %m%e` `cat FileWithDates`; do awk -v month="`sed command to extract int before the first whitespace from $i`" -v day="`sed command to extract int from after first whitespace in $i` " '{m=int((NR-3)/8)*3+1; for (i=0;i<3;i++) {t=substr($0,1+i*22,20) " "; if (m+i==month) sub(day,"\033[0;31m&\033[0m",t);} print t[0],t[1],t[2];}' |;done; echo
    or really anything where I don't have to tack on an awk statement to the end of this thing for every date I want to highlight when it should be possible to get the same from a file. Maybe I'm just addressing this problem wrong... Either way any help would be appreciated!
    I'll readily admit to not knowing enough about awk, so if I'm missing an easy way to fix this that involves changing the awk statement(s) I'm more than open to that too.

    #!/usr/bin/env bash
    # This is example code I used to test.
    # You get to build it anyway you want.
    echo "##############################"
    echo "#### create FileWithDates ####"
    cat >/tmp/FileWithDates <<EOD
    10 31
    4 25
    2 14
    8 4
    EOD
    cat /tmp/FileWithDates # I needed somewhere to put my example file
    echo "##############################"
    # This is the part of the script you are interested in
    cal -y | awk -v month="$(date +%m)" -v day="$(date +%e) " '
    BEGIN {
    # handle the current month and day
    # The +0 makes sure the value is treated
    # as a number, and not a string
    max=0
    sub(/^0/,"",month)
    months[max] = month + 0
    days[max] = day + 0
    max++
    NR == FNR {
    # collect the entries from FileWithDates
    # NR will only equal FNR for the first
    # file being read, so it is essential that
    # FileWithDates is the first file name
    # specified on the awk command line.
    # Again, +0 forces the value to be a
    # number, not a string.
    months[max] = $1 + 0
    days[max] = $2 + 0
    max++
    next # Do not fall into next section
    # We will only get here after fulling reading FileWithDates.
    # The use of - on the command line below tells awk to read from
    # stdin, which in our case should be the output from cal -y
    m = (int((FNR-3)/8) * 3) + 1
    for (i=0; i<3; i++) {
    # extract the week of the month. I have put a space
    # before the week and a space after the week. This
    # does change the cal -y output slightly, but it makes
    # the code easier, as I can depend on every day having
    # a space before and after, which makes getting a
    # unique match much easier.
    t = " " substr($0,1+i*22,20) " "
    for(j=0; j < max; j++) {
    # I added this for(j...) loop to check each of the
    # FileWithDates and the current month and day values
    # against each week of a month.
    if (m+i == months[j]) {
    # I am just marking the days to be colored
    # with :nn@, as I do not want the
    #  [0;31m to be confused for the
    # 31st of the month.
    sub(" "days[j]" ",":"days[j]"@",t)
    # Replace : with space  [0;31m
    # Replace @ with  [0m space
    gsub(/:/,"  [0;31m",t)
    gsub(/@/," [0m ",t)
    # Print each week of the month for this output row
    print t[0],t[1],t[2]
    } ' /tmp/FileWithDates - # the - is essential for reading stdin

  • No dialer command under ISDN BRI interface

    Hi all,
    I have a 2901 router voice bundle with 4 ISDN BRI ports and would like to have them bundled under Dialer1 interface. Unfortunately it doesn't give me option for Dialer command under BRI interface as expected. 
    router(config-if)#int bri0/0/0
    router(config-if)#dia
    router(config-if)#dia
                             ^
    % Invalid input detected at '^' marker.
    router(config-if)#dialer
                             ^
    % Invalid input detected at '^' marker.
    router(config-if)#
    I assume it's down to the UC license installed on the device but not sure. Does the ISDN BRI interface behave in different way under this license?
    Pasting portion of "show ver" as well.
    Cisco CISCO2901/K9 (revision 1.0) with 479232K/45056K bytes of memory.
    Processor board ID 
    2 Gigabit Ethernet interfaces
    4 ISDN Basic Rate interfaces
    1 terminal line
    DRAM configuration is 64 bits wide with parity enabled.
    255K bytes of non-volatile configuration memory.
    250880K bytes of ATA System CompactFlash 0 (Read/Write)
    License Info:
    License UDI:
    Device#   PID                   SN
    *0        CISCO2901/K9          
    Technology Package License Information for Module:'c2900'
    Technology    Technology-package           Technology-package
                  Current       Type           Next reboot
    ipbase        ipbasek9      Permanent      ipbasek9
    security      None          None           None
    uc            uck9          Permanent      uck9
    data          None          None           None
    Configuration register is 0x2102

    Hi,
              Snippet of "sh ver" with IOS version is below:
    router#show ver
    Cisco IOS Software, C2900 Software (C2900-UNIVERSALK9-M), Version 15.2(4)M5, RELEASE SOFTWARE (fc2)
    Technical Support: http://www.cisco.com/techsupport
    Copyright (c) 1986-2013 by Cisco Systems, Inc.
    Compiled Fri 13-Sep-13 14:59 by prod_rel_team
    ROM: System Bootstrap, Version 15.0(1r)M16, RELEASE SOFTWARE (fc1)
    router uptime is 2 days, 21 hours, 47 minutes
    System returned to ROM by reload at 16:48:03 UTC Mon Aug 18 2014
    System restarted at 16:50:01 UTC Mon Aug 18 2014
    System image file is "flash0:c2900-universalk9-mz.SPA.152-4.M5.bin"
    Last reload type: Normal Reload
    Last reload reason: Reload Command
    The output of trying to type dialer command is in the initial post, I'm also pasting all available commands under bri0/0/0.
    router(config-if)#int bri0/0/0
    router(config-if)#?
    Interface configuration commands:
      aaa                     Authentication, Authorization and Accounting.
      access-expression       Build a bridge boolean access expression
      arp                     Set arp type (arpa, probe, snap), timeout, log
                              options or packet priority
      authentication          Auth Manager Interface Configuration Commands
      autodetect              Autodetect Encapsulations on Serial interface
      bandwidth               Set bandwidth informational parameter
      bgp-policy              Apply policy propagated by bgp community string
      bridge-group            Transparent bridging interface parameters
      carrier-delay           Specify delay for interface transitions
      cdp                     CDP interface subcommands
      clns                    CLNS interface subcommands
      clock                   Configure serial interface clock
      cwmp                    Configure CPE WAN Management Protocol(CWMP) on this
                              interface
      dampening               Enable event dampening
      default                 Set a command to its defaults
      delay                   Specify interface throughput delay
      description             Interface specific description
      dot1q                   dot1q interface configuration commands
      dot1x                   Interface Config Commands for IEEE 802.1X
      down-when-looped        Force looped serial interface down
      encapsulation           Set encapsulation type for an interface
      ethernet                Ethernet interface parameters
      exit                    Exit from interface configuration mode
      flow-sampler            Attach flow sampler to the interface
      full-duplex             Configure full-duplex operational mode
      h323-gateway            Configure H323 Gateway
      half-duplex             Configure half-duplex and related commands
      help                    Description of the interactive help system
      history                 Interface history histograms - 60 second, 60 minute
                              and 72 hour
      hold-queue              Set hold queue depth
      ip                      Interface Internet Protocol config commands
      iphc-profile            Configure IPHC profile
      ipv6                    IPv6 interface subcommands
      isdn                    ISDN Interface configuration commands
      isis                    IS-IS commands
      iso-igrp                ISO-IGRP interface subcommands
      keepalive               Enable keepalive
      line-power              Provide power on the line.
      llc2                    LLC2 Interface Subcommands
      load-interval           Specify interval for load calculation for an
                              interface
      logging                 Configure logging for interface
      loopback                Configure internal loopback on an interface
      mab                     MAC Authentication Bypass Interface Config Commands
      mac-address             Manually set interface MAC address
      macro                   Command macro
      metadata                Metadata Application
      mop                     DEC MOP server commands
      mtu                     Set the interface Maximum Transmission Unit (MTU)
      netbios                 Use a defined NETBIOS access list or enable
                              name-caching
      network-clock-priority  Configure clock source priority
      no                      Negate a command or set its defaults
      ntp                     Configure NTP
      ospfv3                  OSPFv3 interface commands
      pulse-time              Force DTR low during resets
      rate-limit              Rate Limit
      redundancy              RG redundancy interface config
      routing                 Per-interface routing configuration
      sdllc                   Configure SDLC to LLC2 translation
      serial                  serial interface commands
      service-policy          Configure CPL Service Policy
      shutdown                Shutdown the selected interface
      smds                    Modify SMDS parameters
      snapshot                Configure snapshot support on the interface
      snmp                    Modify SNMP interface parameters
      source                  Get config from another source
      tarp                    TARP interface subcommands
      timeout                 Define timeout values for this interface
      topology                Configure routing topology on the interface
      transmit-interface      Assign a transmit interface to a receive-only
                              interface
      trunk-group             Configure interface to be in a trunk group
      tx-ring-limit           Configure PA level transmit ring limit
      vpdn                    Virtual Private Dialup Network
      vrf                     VPN Routing/Forwarding parameters on the interface
      waas                    WAN Optimization
    router(config-if)#

  • ODI file append with unix command problem

    Hi everyone,
    I will apennd multiple files to a main file in a directory.I wrote jython code like this:
    import os
    sourceDirectory = "/home/oracle1/Desktop/test"
    inFileNames = "#FILE_NAMES"
    inFileNamesList = inFileNames.split(" ")
    inFileIDS = *"'a','1','2','3'"*
    inFileIDSList = inFileIDS.split(",")
    i = 0
    for item in inFileNamesList:
         command ="awk 'BEGIN {OFS=\"" + "#FILE_DELIMITER\"" + "} {print $0,\"[|]\"" + *inFileIDSList* + ",\"[|]\"NR}' " + sourceDirectory + os.sep + item + " >> " + sourceDirectory + os.sep + "#SESS_CURR_TS"
         os.system(command)
         i = i + 1
    Now my problem is here :
    Yu can seee my inFileIDS values.Ana I have splitted comma and then first I will write file then *inFileIDSList[i]* and at the and NR
    But character a is not written.Number values is appended but character values is not appended.
    Why it can be so ?
    someone has an idea about this problem
    Coluld anyone help me to solve this problem?
    Regards

    import os
    sourceDirectory = "#SOURCE_DIRECTORY"
    inFileNames = "#FILE_NAMES"
    inFileNamesList = inFileNames.split(" ")
    inFileIDS = "#FILE_IDS"
    inFileIDSList = inFileIDS.split(",")
    i = 0
    for item in inFileNamesList:
         command ="awk 'BEGIN {OFS=\"" + "#FILE_DELIMITER\"" + "} {print $0,\"\"*FILENAME*}' " + sourceDirectory + os.sep + item + " >> " + sourceDirectory + os.sep + "#SESS_CURR_TS"
         os.system(command)
         i = i + 1
    My original code is above.Now I am printing file datas and I want to print file name that are being ready.
    First print$0(all line) and field_delimiter(;) and then I will print filename which file is processed.My output file will be like this:
    all line;FILENAME
    But I write FILENAME into awk command it returns with path .So for example likie this:/d102/odi/uca/arrival/data/T02344903302310.txt .But I want to print only file name without paths.
    I want to print T02344903302310.txt so my output file will be like this:
    all_line;T02344903302310.txt and there are many files like this.
    Could anyone has an idea?

  • No export command in Nexus 1010

    Hi all,
    We want to do a backup of a virtual-service-blade in a Nexus 1010. The document we are following is:
    http://www.cisco.com/en/US/docs/switches/datacenter/nexus1000/sw/4_2_1_s_p_1_3/software/configuration/guide/n1010_vsvcs_cfg_7backup.html
    What we are supposed to do fron this document is to create a file named export-import, to shutdown the primary o secondary virtual service blades, and after it, to execute the command "export primary" o "export secondary", depending on which vsb we want to export.
    ========= DETAILED STEP IN THE DOCUMENT ================
    n1010-1(config-vsb-config)# export  secondary
    Note: export started..
    Note: please be patient..
    Note: please be patient..
    Note: please be patient..
    Note: export  completed...n1010-1(config-vsb-config)#
    ====================================================
    The problem is that this "export" command is not available in our nexus 1010.
    =========== NEXUS 1010 ===============================
    N1010-MGMT(config-vsb-config)# export secondary
                                     ^
    % Invalid command at '^' marker.
    N1010-MGMT(config-vsb-config)#
    N1010-MGMT(config-vsb-config)#
    N1010-MGMT(config-vsb-config)# ?
      description                 Virtual service blade description
      disksize                    Configure disk size
      enable                      Deploy/remove the virtual service blade
      interface                   Configure virtual service blade interface vlan
      no                          Negate a command or set its defaults
      numcpu                      Configure numcpu
      ramsize                     Configure ram size
      shutdown                    Start/stop the virtual service blade
      virtual-service-blade-type  Select the virtual service blade type
      end                         Go to exec mode
      exit                        Exit from command interpreter
      pop                         Pop mode from stack or restore from name
      push                        Push current mode to stack or save it under name
      where                       Shows the cli context you are in
    =====================================================
    The version of the nexus is the same than the document's one.
    Document: 4.2(1)SP1(3) ==> Nexus 1010: version 4.2(1)SP1(2)
    Software
      loader:    version unavailable [last: loader version not available]
      kickstart: version 4.2(1)SP1(2)
      system:    version 4.2(1)SP1(2)
      kickstart image file is: bootflash:/nexus-1010-kickstart-mz.4.2.1.SP1.2.bin
      kickstart compile time:  1/27/2011 14:00:00 [01/28/2011 01:14:35]
      system image file is:    bootflash:/nexus-1010-mz.4.2.1.SP1.2.bin
      system compile time:     1/27/2011 14:00:00 [01/28/2011 04:13:25]
    Hardware
      cisco Nexus 1010 Chassis ("Cisco Nexus1010 Chassis")
       with 14665728 kB of memory.
      Processor Board ID T023D700201
    We don't know which can be the problem, wheter it can be a bug in the software, or we are doing something wrong.
    Thank you

    The export command was a new feature added in the 4.2(1)SP1(3) version of code. Your 1010 is one rev lower.
    You'll need to upgrade the code on the 1010 to the latest code to get the export command.
    The upgrade is pretty straight forward. Just download the code and follow the upgrade guide.
    louis

  • MDS 9124 -- Limited Command Set?

    I've got two MDS 9124 FiberChannel switches, and can SSH into them using RADIUS authentication with my domain admin user.
    I'm trying to do things, like update the license file, but lots of "normal" commands, like "copy" which is documented in the license update procedure, are missing. Page 1-6 of this PDF [command reference for SAN-OS 3.x] lists many more commands that I don't seem to have: http://www.cisco.com/en/US/docs/storage/san_switches/mds9000/sw/rel_3_x/command/reference/CR03.pdf
    The rest of this post will be (1) the output of "?" at the EXEC prompt, (2) the output of "?" at the Config prompt, (3) the output of "show version":
    FCSwitch01# ?
    Exec commands:
      attach      Connect to a specific linecard
      cd          Change current directory
      cfs         CFS parameters
      clear       Reset functions
      cli         CLI commands
      clock       Manage the system clock
      config      Enter configuration mode
      dir         List files in a directory
      discover    Discover information
      exit        Exit from the EXEC
      fcping      Ping an N-Port
      fctrace     Trace the route for an N-Port.
      find        Find a file below the current directory
      no          Disable debugging functions
      ping        Send echo messages
      pwd         View current directory
      send        Send message to open sessions
      show        Show running system information
      sleep       Sleep for the specified number of seconds
      ssh         SSH to another system
      tail        Display the last part of a file
      telnet      Telnet to another system
      terminal    Set terminal line parameters
      test        Test command
      traceroute  Trace route to destination
    FCSwitch01(config)# ?
    Configure commands:
      cli        CLI configuration commands
      do         EXEC command
      end        Exit from configure mode
      exit       Exit from configure mode
      hw-module  Enable/Disable OBFL information
      no         Negate a command or set its defaults
      username   Configure user information.
    FCSwitch01# show version
    Software
      BIOS:      version 1.0.12
      kickstart: version 3.3(1c)
      system:    version 3.3(1c)
      BIOS compile time:       09/10/07
      kickstart image file is: bootflash:/m9100-s2ek9-kickstart-mz.3.3.1c.bin
      kickstart compile time:  5/23/2008 19:00:00 [06/20/2008 04:29:52]
      system image file is:    bootflash:/m9100-s2ek9-mz.3.3.1c.bin
      system compile time:     5/23/2008 19:00:00 [06/20/2008 04:51:10]
    Hardware
      cisco MDS 9124 ("1/2/4 Gbps FC/Supervisor-2")
      Motorola, ppc8541 (e500) with 515032 kB of memory.
      Processor Board ID JAE1133U87Q
      bootflash: 250368 kB
    FCSwitch01   kernel uptime is 2 days 0 hour 24 minute(s) 48 second(s)

    Hi Jon,
    Do you have access to the radius server?  Can you set the shell:roles="network-admin" attribute on your account?
    Unfortunately if you don't remember the password of any accounts with network-admin you will need to do a password recovery which is a disruptive process.  Below are the instructions for the MDS:
    Power Cycling the Switch
    If you cannot start a session on the switch that has network-admin privileges, you must recover the administrator password by power cycling the switch.
    Caution This procedure disrupts all traffic on the switch. All connections to the switch will be lost for 2 to 3 minutes.
    Note You cannot recover the administrator password from a Telnet or SSH session. You must have access to the local console connection. See the "Starting a Switch in the Cisco MDS 9000 Family" section on page 5-2 for information on setting up the console connection.
    To recover a administrator password by power cycling the switch, follow these steps:
    Step 1 For Cisco MDS 9500 Series switches with two supervisor modules, remove the supervisor module in
    slot 6 from the chassis.
    Note On the Cisco MDS 9500 Series, the password recovery procedure must be performed on the active supervisor module. Removing the supervisor module in slot 6 ensures that a switchover will not occur during the password recovery procedure.
    Step 2 Power cycle the switch.
    Step 3 Press the Ctrl-] key sequence when the switch begins its Cisco NX-OS software boot sequence to enter the switch(boot)# prompt mode.
    Ctrl-]
    switch(boot)#
    Step 4 Change to configuration mode.
    switch(boot)# config terminal
    Step 5 Issue the admin-password command to reset the administrator password.
    switch(boot-config)# admin-password <new password>
    For information on strong passwords, see the "Characteristics of Strong Passwords" section.
    Step 6 Exit to the EXEC mode.
    switch(boot-config)# exit
    switch(boot)#
    Step 7 Issue the load command to load the Cisco NX-OS software.
    switch(boot)# load bootflash:m9500-sf1ek9-mz.2.1.1a.bin
    Caution If you boot a system image that is older than the image you used to store the configuration and do not use the install all command to boot the system, the switch erases the binary configuration and uses the ASCII configuration. When this occurs, you must use the init system command to recover your password.
    Step 8 Log in to the switch using the new administrator password.
    switch login: admin
    Password: <new password>
    Step 9 Reset the new password to ensure that is it is also the SNMP password for Fabric Manager.
    switch# config t
    switch(config)# username admin password <new password>
    switch(config)# exit
    switch#
    Step 10 Save the software configuration.
    switch# copy running-config startup-config
    Step 11 Insert the previously removed supervisor module into slot 6 in the chassis.

  • Service instance command is not as documented

    Hi,
    I use Cisco 7609 with IOS 15.0(1)S1 and with ES+ module.
    I try to configure a service instance, but the only possible commands I get are:
    Router-1(config-if)#ser insta 22eth
    Router-1(config-if-srv)#?
    Ethernet EFP configuration commands:
      default   Set a command to its defaults
      ethernet  Configure ether lmi parameters
      exit      Exit from ETHER EFP configuration mode
      no        Negate a command or set its defaults
    I need the "encapsulation ... " command.
    Could someone explain what is the problem? ES+ module supports EVC-style configuration and Cisco official documentation claims that the above mentioned command IS supported.
    Thanks,
    Yoav.

    Hello Yoav
    Yes indeed it should be supported .. Is it possible to try different IOS if it is a lab router
    NPE-1(config-if)#ser in 10 ethernet
    NPE-1(config-if-srv)#?
    Ethernet EFP configuration commands:
      default        Set a command to its defaults
      description    Service instance specific description
      encapsulation  Configure ethernet frame match criteria
      errdisable      Configure error disable
      ethernet        ethernet
      exit            Exit from ETHER EFP configuration mode
      group          Join a service group
      ip              Interface Internet Protocol config commands
      l2protocol      Configure l2 control protocol processing
      mac            Commands for MAC Address-based features
      no              Negate a command or set its defaults
      service-policy  Attach a policy-map to an EFP
      shutdown        Take the Service Instance out of Service
      snmp            Modify SNMP service instance parameters
      weight          Assign a weight to an EFP
    NPE-1(config-if-srv)#
    Regards
    Sherif Ismail

  • Awk - printing a value between two matching regex [SOLVED]

    I'm trying to write a script to parse a single line output, but to then only display the value between two matching regex.
    I have got it to only display the value between the matching regex, but then it carries on and displays the rest of the line. How do I tell it to stop once the matching value has been printed?
    ARTIST=`awk '/Artist/,/Artist/ {gsub(/Artist/, Artist); print}' /home/sapphire/.foobar2000/track_info`
    This produces 'Akira Yamaoka Title She Title Album Silent Hill 1 OST Album CurrentTime 0:03 CurrentTime TotalTime 2:01 TotalTime' rather then the desired 'Akira Yamaoka'.
    So I guess I'm asking how one would go about terminating the above awk command? Thanks - I know, it'll be something simple - but I'm not experienced with scripting
    Last edited by wyvern (2008-04-10 11:37:30)

    ibendiben wrote:Could you share the file you are extracting the data from?
    No problem, and thank you for the help so far
    This is what's written each time I update my playing track, no more, no less:
    Artist Akira Yamaoka Artist Title Silent Hill Title Album Silent Hill 1 OST Album CurrentTime 0:04 CurrentTime TotalTime 2:51 TotalTime
    Single line only, as the plugin won't break up the text into anything more than the one line

  • Shell: Multiple commands via ssh / subshell

    Hello,
    I have this script:
    #!/bin/sh
    SP_CONFIG=/home/flindner/spider/spFackrellB2+innerBox.conf
    ssh flindner@yoko "ssh yuka << 'ENDSSH'
    MESH=`awk '/OUTFILENAME/ {getline; print}' $SP_CONFIG`
    ENDSSH"
    executed with sh -x
    florian@horus ~ % sh -x ./remote_spider_test.sh
    + SP_CONFIG=/home/flindner/spider/spFackrellB2+innerBox.conf
    ++ awk '/OUTFILENAME/ {getline; print}' /home/flindner/spider/spFackrellB2+innerBox.conf
    awk: fatal: cannot open file `/home/flindner/spider/spFackrellB2+innerBox.conf' for reading (No such file or directory)
    + ssh flindner@yoko 'ssh yuka << '\''ENDSSH'\''
    MESH=
    ENDSSH'
    But when I execute the awk command on the machine yuka it works just fine:
    flindner@yuka:~> awk '/OUTFILENAME/ {getline; print}' /home/flindner/spider/spFackrellB2+innerBox.conf
    meshFackrellB2+innerBox.msh
    Therefore I think that somehow awk is being executed on my local machine and not on either one on the remote machines (I would be running on yoko too).
    Why is that? How can I execute it on yoko like it was intented? Other commands played just well, I suspect the problem is connected to the subshell execution of awk.
    Thanks a lot!

    The problem here is that the shell will evaluate the string inside "" before running the command. that means the awk-line will run locally. Try using ' instead of " around the  ssh yuka ... ENDSSH.  Single quotes will prevent the shell from evaluating anything inside like variables or subshell stuff. Also use $( .. ) instead of ` `, because its more readable
    Last edited by seiichiro0185 (2011-09-19 14:11:15)

  • Sed, awk & piping

    Hey all,
    I'm wanting to look for a specific line and word which I have been able to with the following command
    sed -n '3p' | awk {'print $2'}
    I then couldn't really figure out how to properly pipe the awk result out so I made the whole command into a variable like so:
    var="$(sed -n '3p' | awk {'print $2'})"
    echo $var;
    This give the same output.
    Now one of two things. So is there a way to properly pipe the result into another sed command with out having to set it as a variable
    OR
    I tried using said variable to use the sed command again separately, only this time to replace the value i found.
    with sed 's/$a/some_string/g' FILE  (the file is a (dot) file if it matters)
    No matter how I seem to do this I can't seem to get the variable to work with the search and replace tool of SED.
    Any help would be much appreciated. Let me know if sed or ed would be better to use.

    So is there a way to properly pipe the result into another sed command with out having to set it as a variable
    just put another vertical bar and the next command, such as the following:
    sed -n '3p' input.file | awk '{print $2}' | next_command | and_the_next | etc...
    var="$(sed -n '3p' | awk '{print $2}')"
    echo $var;
    If all you wanted to do was print the output from 'awk', then you shouldn't need to do anything special beyond:
    sed -n '3p' input.file | awk '{print $2}'
    as awk sends its output to standard out, just like 'echo'.  Of course if you want to do "Other" things to 'var', then it can be useful to capture the output, but to just display it via 'echo' all you need to do is let 'awk' send it to standard output as it normally does.
    You 'awk' notation is wrong.  You have { 'print $2' }, when what you should have is ' { print $2 } '.  That is to say, the { print $2 } should be inside the single quotes.
    If I understand your "sed -n '3p' input.file", you are printing the 3rd line of the input, then capturing the 2nd field via 'awk'.  You could do all of this with just awk
    awk 'NR==3 { print $2; exit }' input.file
    Where NR is the current record (line) number, so when NR == 3, it is the 3rd line.  The 'exit' stops the awk script after you get what you were after, so awk does not read the rest of the file.
    If you want to capture the 2nd field for additional use in the script, such as a substitute value, then it is good to capture the field in a variable
    var=$(awk 'NR==3 {print $2}' input.file)
    sed -e "s/$var/some_string/g" input.file >output.file
    Important things to note.  I used double-quotes "..." so that the shell will substitute the contents of $var into the 'sed' command.
    HOWEVER, I use single-quotes '...' around the 'awk' commands because I DO NOT want the shell to see the $2 and the single-quotes protect the $2 from the shell, so that 'awk' can see the $2 and do the 'awk' things with $2.
    The shell will perform variable substitutions inside double-quotes "...".  The shell will NOT do variable substitution inside single-quotes '...'
    If you would prefer to use var=$(sed -n '3p' input.file | awk '{print $2}') that is perfectly OK, just less efficient, but if you understand it, then it works.

  • How to retrieve only error message through report file

    Hi,
    When there is extract/replicat abended,we need to check complete report file to see the error message.
    I would like to know is there parameter setting available ,so that we can retrieve only required error message.
    For ex. Instead of complete error message to check in report file,i need to see below meesage only,starting from "source Context".
    Source Context :
    SourceModule : [er.main]
    SourceID : [scratch/pradshar/view_storage/pradshar_bugdbrh40_12927937/oggcore/OpenSys/src/app/er/rep.c]
    SourceFunction : [get_map_entry]
    SourceLine : [9126]
    ThreadBacktrace : [11] elements
    : [ora/gg/install/replicat(CMessageContext::AddThreadContext()+0x26) [0x5f2ac6]]
    : [ora/gg/install/replicat(CMessageFactory::CreateMessage(CSourceContext*, unsigned int, ...)+0x7b2) [0x5e9562]]
    : [ora/gg/install/replicat(_MSG_ERR_DB_CLAUSE_ERROR(CSourceContext*, char const*, CMessageFactory::MessageDisposition)+0x92) [0x5b1352]
    : [ora/gg/install/replicat(get_map_entry(char*, int, __wc*, int)+0x1dd6) [0x4fcec6]]
    : [ora/gg/install/replicat [0x5497e5]]
    : [/ora/gg/install/replicat(WILDCARD_check_table(char const*, char const*, int, unsigned int*, int, unsigned int, DBString<777>*, int)+0
    x16b) [0x54b08b]]
    : [ora/gg/install/replicat(REP_find_source_file_wc(char const*, unsigned int, DBString<777>*, int)+0x350) [0x903d50]]
    : [ora/gg/install/replicat [0x90bb0d]]
    : [ora/gg/install/replicat(main+0x84b) [0x5081ab]]
    : [lib64/libc.so.6(__libc_start_main+0xf4) [0x2b87d13469b4]]
    : [ora/gg/install/replicat(__gxx_personality_v0+0x1da) [0x4e479a]]
    2012-07-09 02:20:48 ERROR OGG-00919 Error in COLMAP clause.
    --------------------------------------------------------------------------------------------------------------------------------------------------------

    Nice..i think awk is better option.
    Just one thing.awk command only displays part of the information instead of complete below information.
    Ex: egrep -q ERROR dirrpt/PODS00C1.rpt && awk '/^Source Context/,/ERROR/ { print $0 }' dirrpt/PODS00C1.rpt
    [22:00]goldengate]$ egrep -q ERROR dirrpt/PODS00C1.rpt && awk '/^Source Context/,/ERROR/ { print $0 }' dirrpt/PODS00C1.rpt
    Source Context :
    SourceModule : [ggdb.ora.sess]
    SourceID : [scratch/pradshar/view_storage/pradshar_bugdbrh40_12927937/oggcore/OpenSys/src/gglib/ggdbora/ocisess.c]
    SourceFunction : [OCISESS_try]
    SourceLine : [500]
    ThreadBacktrace : [12] elements
    : [orashare/gg/navc1/extract(CMessageContext::AddThreadContext()+0x26) [0x6705e6]]
    : [orashare/gg/navc1/extract(CMessageFactory::CreateMessage(CSourceContext*, unsigned int, ...)+0x7b2) [0x667082]]
    : [orashare/gg/navc1/extract(_MSG_ERR_ORACLE_OCI_ERROR_WITH_DESC(CSourceContext*, int, char const*, char const*, CMessageFactory::MessageDisposition)+0xa6) [0x61f2c6]]
    Where as i would like to see complete information including ERROR details as mentioned below.Do you have any awk command for this?
    Required below output:
    Source Context :
    SourceModule : [ggdb.ora.sess]
    SourceID : [scratch/pradshar/view_storage/pradshar_bugdbrh40_12927937/oggcore/OpenSys/src/gglib/ggdbora/ocisess.c]
    SourceFunction : [OCISESS_try]
    SourceLine : [500]
    ThreadBacktrace : [12] elements
    : [orashare/gg/navc1/extract(CMessageContext::AddThreadContext()+0x26) [0x6705e6]]
    : [orashare/gg/navc1/extract(CMessageFactory::CreateMessage(CSourceContext*, unsigned int, ...)+0x7b2) [0x667082]]
    : [/orashare/gg/navc1/extract(_MSG_ERR_ORACLE_OCI_ERROR_WITH_DESC(CSourceContext*, int, char const*, char const*, CMessageFactory::MessageDisp
    osition)+0xa6) [0x61f2c6]]
    : [orashare/gg/navc1/extract(OCISESS_try(int, OCISESS_context_def*, char const*, ...)+0x353) [0x5a3d53]]
    : [orashare/gg/navc1/extract(OCISESS_logon(OCISESS_context_def*, char const*, char const*, char const*, int, int, int)+0x89c) [0x5a596c]]
    : [orashare/gg/navc1/extract(DBOCI_init_connection_logon(char const*, char const*, char const*, int, int, int, char*)+0x74) [0x5931a4]]
    : [orashare/gg/navc1/extract [0x597918]]
    : [orashare/gg/navc1/extract(gl_odbc_param(char const*, char const*, char*)+0x3b) [0x597f1b]]
    : [orashare/gg/navc1/extract [0x520b96]]
    : [orashare/gg/navc1/extract(main+0x1ce) [0x52726e]]
    : [lib64/libc.so.6(__libc_start_main+0xf4) [0x2af768923994]]
    : [orashare/gg/navc1/extract(__gxx_personality_v0+0x1ea) [0x4f3aba]]
    2012-09-06 16:48:50 ERROR OGG-00664 OCI Error beginning session (status = 1017-ORA-01017: invalid username/password; logon denied).
    2012-09-06 16:48:50 ERROR OGG-01668 PROCESS ABENDING.

  • How can I list all folders that contain files with a specific file extension? I want a list that shows the parent folders of all files with a .nef extension.

    not the total path to the folder containing the files but rather just a parent folder one level up of the files.
    So file.nef that's in folder 1 that's in folder 2 that's in folder 3... I just want to list folder 1, not 2 or 3 (unless they contain files themselves in their level)

    find $HOME -iname '*.nef' 2>/dev/null | awk -F '/'   'seen[$(NF-1)]++ == 0 { print $(NF-1) }'
    This will print just one occurrence of directory
    The 'find' command files ALL *.nef files under your home directory (aka Folder)
    The 2>/dev/null throws away any error messages from things like "permissions denied" on a protected file or directory
    The 'awk' command extracts the parent directory and keeps track of whether it has displayed that directory before
    -F '/' tells awk to split fields using the / character
    NF is an awk variable that contains the number of fields in the current record
    NF-1 specifies the parent directory field, as in the last field is the file name and minus one if the parent directory
    $(NF-1) extracts the parent directory
    seen[] is a context addressable array variable (I choose the name 'seen'). That means I can use text strings as lookup keys.  The array is dynamic, so the first time I reference an element, if it doesn't exist, it is created with a nul value.
    seen[$(NF-1)] accesses the array element associated with the parent directory.
    seen[$(NF-1)]++ The ++ increments the element stored in the array associated with the parent directory key AFTER the value has been fetched for processing.  That is to say the original value is preserved (short term) and the value in the array is incremented by 1 for the next time it is accessed.
    the == 0 compares the fetched value (which occurred before it was incremented) against 0.  The first time a unique parent directory is used to access the array, a new element will be created and its value will be returned as 0 for the seen[$(NF-1)] == 0 comparison.
    On the first usage of a unique parent directory the comparison will be TRUE, so the { print $(NF-1) } action will be performed.
    After the first use of a unique parent directory name, the seen[$(NF-1)] access will return a value greater than 0, so the comparison will be FALSE and thus the { print $(NF-1)] } action will NOT be performed.
    Thus we get just one unique parent directory name no matter how many *.nef files are found.  Of course you get only one unique name, even if there are several same named sub-directories but in different paths
    You could put this into an Automator workflow using the "Run Shell Script" actions.

  • Need help with QoS config/setup for my home network.

    I have a home network that spans two buildings, has and FTP download server, VoIP phones,and several computers among other IP devices.  I run a home based business where my clients get access to the company FTP download server (NOT illegal file sharing).  the problem is that when they are downloading files my VoIP takes a big hit and gets choppy when speaking to my customers.  Below is  the layout of the network.
    Our Internet access is Verizon 4G, there are no other options available at this time or we would switch.  The Verizon 4G MiFi connects to a TP-Link wifi router that then connects to port fa0/5 on the Office 3550PoE switch.  There is a trunk between the Office switch to the House 3550PoE switch.  The House switch then connects to the Shop 3524XL switch also using a trunk.  Please note that EVERYTHING works fine other than the VoIP issue, VoIP makes and receives calls without connections issues.
    Auto QoS has been run on the Office switch ports fa0/1 and fa0/2 as well as on the House switch ports fa0/3 and fa0/5.  There is NO auto QoS on the 3524XL
    What is the best way to give VoIP traffic top priority over FTP and web browsing when going out port fa0/5 on the Office Switch?  Over the internal network we are not having any call quality issues between the IP phones, just calls to our SIP provider.  Yes, I understand that once calls exit the Office switch to the TP-Link wifi router there will not be any QoS.  But, if I can give priority to the packets at the layer 3 Office switch (or wherever you suggest) then at least I will not have to kill a users FTP download while I am on the phone.
    Thank You

    I can make ANY changes necessary, just need to know what to do.
    First, did you notice the output of the command  sh mls qos fa0/5 above?  Is it working correctly?
    Next, Yes I do have version W17 and can install if if needed.  The lost of possible commands I listed above was from the conf t - config interface fa0/x level.  There is class and policy mapping commands the the config global level along with all these other commands:
      aaa                         Authentication, Authorization and Accounting.
      access-list                 Add an access list entry
      alias                       Create command alias
      arp                         Set a static ARP entry
      banner                      Define a login banner
      boot                        Boot Commands
      buffers                     Adjust system buffer pool parameters
      cdp                         Global CDP configuration subcommands
      cgmp                        Global CGMP configuration commands
      class-map                   Configure QoS Class Map
      clock                       Configure time-of-day clock
      cluster                     Cluster configuration commands
      default                     Set a command to its defaults
      default-value               Default character-bits values
      downward-compatible-config  Generate a configuration compatible with older software
      enable                      Modify enable password parameters
      end                         Exit from configure mode
      errdisable                  Error disable
      exception                   Exception handling
      exit                        Exit from configure mode
      file                        Adjust file system parameters
      help                        Description of the interactive help system
      hostname                    Set system's network name
      interface                   Select an interface to configure
      ip                          Global IP configuration subcommands
      line                        Configure a terminal line
      logging                     Modify message logging facilities
      mac-address-table           Configure the MAC address table
      map-class                   Configure static map class
      map-list                    Configure static map list
      mvr                         Enable/Disable MVR on the switch
      no                          Negate a command or set its defaults
      ntp                         Configure NTP
      policy-map                  Configure QoS Policy Map
      power                       power configuration
      priority-list               Build a priority list
      privilege                   Command privilege parameters
      queue-list                  Build a custom queue list
      rmon                        Remote Monitoring
      scheduler                   Scheduler parameters
      service                     Modify use of network based services
      shutdown                    Shutdown system elements
      snmp-server                 Modify SNMP parameters
      spanning-tree               Spanning Tree Subsystem
      stackmaker                  Specify stack name and add its member
      tacacs-server               Modify TACACS query parameters
      tftp-server                 Provide TFTP service for netload requests
      time-range                  Define time range entries
      udld                        Configure global UDLD setting
      username                    Establish User Name Authentication
      vmps                        VMPS settings
      vtp                         Configure global VTP state

  • How Can I change all User Passwords Within a Directory Instance

    Hi Experts,
    I've been asked to refresh an old directory instance with some production data.  Easy enough I thought, however, the user has requested that all user passwords within the old directory instance are preserved.  Is that at all possible?  My chain of thought was that I can extract user passwords from the old instance into a file: -
    # ldapsearch -D cn="Directory Manager" -w xxxxxxxx -b o=xxxxxxx objectclass=* userpassword > <name of file>
    And then then use ldapmodify (or alike) to re-import the user passwords once I've refresh the old instance with the production data.  However, to my knowledge, in order to modify a particular entry via a file, i'd need the following format: -
    dn: gci=-1,ou=people,o=xxxxxxxx
    changetype: modify
    replace: userpassword
    userpassword: xxxxxxxxxxxxxxxx
    The only information I have in the file I created using the ldapsearch command above is as follows: -
    dn: gci=-1,ou=people,o=xxxxxxxx
    userpassword: xxxxxxxxxxxxxxxx
    I don't want to have to edit the file and add the relevant missing entries accordingly as the generated file has somewhere in the region of 150 thousand entries.
    Am I approaching this the correct way?  Is there any other mean of achieving my requirement.
    Thanks in Advance.

    Hi,
    It does not seem a big deal to add the missing lines to your output file.
    For instance, the following awk command should do the trick
    cat search.out
    dn: gci=-1,ou=people,o=xxxxxxxx
    userpassword: xxxxxxxxxxxxxxxx
    cat search.out | awk '/userpassword/ {print "changetype: modify} ; print "replace: userpassword"; }  {print $0}
    dn: gci=-1,ou=people,o=xxxxxxxx
    changetype: modify
    replace: userpassword
    userpassword: xxxxxxxxxxxxxxxx
    Then you can use ldapmodify to apply your changes
    -Sylvain

  • N2K port speed set

    My N2K connected to N5K, why some ports can set the port speed, and some cann't set the port speed?
    int eth102/1/25     !!!No speed command
    (config-if)# ?
      beacon          Disable/enable the beacon for an interface
      cdp             Configure CDP interface parameters
      channel-group   Configure port channel parameters
      description     Enter description of maximum 80 characters
      inherit         Inherit a port-profile
      ip              Configure IP features
      ipv6            Configure IPv6 features
      lacp            Configure LACP parameters
      link            Configure link
      lldp            Configure Interface LLDP parameters
      logging         Configure logging for interface
      mvr-group       MVR interface config
      mvr-type        MVR interface config
      mvr-vlan        Interface MVR Config
      no              Negate a command or set its defaults
      rate-limit      Set packet per second rate limit
      service-policy  Configure service policy for an interface
      service-policy  Policy Map
      shutdown        Enable/disable an interface
      snmp            Modify SNMP interface parameters
      spanning-tree   Spanning Tree Subsystem
      switchport      Configure switchport parameters
      untagged        Default to use for untagged packets on interface
      end             Go to exec mode
      exit            Exit from command interpreter
      pop             Pop mode from stack or restore from name
      push            Push current mode to stack or save it under name
      where           Shows the cli context you are in
    (config-if)# int eth102/1/48       !!! include speed command
    (config-if)# ?
      bandwidth              Set bandwidth informational parameter
      beacon                 Disable/enable the beacon for an interface
      cdp                    Configure CDP interface parameters
      channel-group          Configure port channel parameters
      default                Set a command to its defaults
      delay                  Specify interface throughput delay
      description            Enter description of maximum 80 characters
      duplex                 Enter the port duplex mode
      fex                    Configure FEX fabric
      flowcontrol            Configure interface flowcontrol
      hardware               FEX Card type
      inherit                Inherit a port-profile
      ip                     Configure IP features
      ipv6                   Configure IPv6 features
      lacp                   Configure LACP parameters
      link                   Configure link
      lldp                   Configure Interface LLDP parameters
      load-interval          Specify interval for load calculation for an interface
      logging                Configure logging for interface
      mac                    MAC
      mac-address            Configure interface mac address
      mvr-group              MVR interface config
      mvr-type               MVR interface config
      mvr-vlan               Interface MVR Config
      negotiate              Configure link negotiation parameters
      no                     Negate a command or set its defaults
      priority-flow-control  Enable/Disable PFC
      rate-limit             Set packet per second rate limit
      service-policy         Configure service policy for an interface
      service-policy         Policy Map
      shutdown               Enable/disable an interface
      snmp                   Modify SNMP interface parameters
      spanning-tree          Spanning Tree Subsystem
      speed                  Enter the port speed
      storm-control          Configure Interface storm control
      switchport             Configure switchport parameters
      untagged               Default to use for untagged packets on interface
      vpc                    Virtual Port Channel configuration
      vtp                    Enable VTP on this interface
      end                    Go to exec mode
      exit                   Exit from command interpreter
      pop                    Pop mode from stack or restore from name
      push                   Push current mode to stack or save it under name
      where                  Shows the cli context you are in
    1,N5K version:
    Cisco Nexus Operating System (NX-OS) Software
    TAC support: http://www.cisco.com/tac
    Documents: http://www.cisco.com/en/US/products/ps9372/tsd_products_support_series_home.html
    Copyright (c) 2002-2013, Cisco Systems, Inc. All rights reserved.
    The copyrights to certain works contained herein are owned by
    other third parties and are used and distributed under license.
    Some parts of this software are covered under the GNU Public
    License. A copy of the license is available at
    http://www.gnu.org/licenses/gpl.html.
    Software
      BIOS:      version 3.6.0
      loader:    version N/A
      kickstart: version 6.0(2)N1(2)
      system:    version 6.0(2)N1(2)
      Power Sequencer Firmware:
                 Module 1: version v5.0
      Microcontroller Firmware:        version v1.0.0.2
      SFP uC:    Module 1: v1.1.0.0
      QSFP uC:   Module not detected
      BIOS compile time:       05/09/2012
      kickstart image file is: bootflash:///n5000-uk9-kickstart.6.0.2.N1.2.bin
      kickstart compile time:  3/14/2013 1:00:00 [03/14/2013 16:53:55]
      system image file is:    bootflash:///n5000-uk9.6.0.2.N1.2.bin
      system compile time:     3/14/2013 1:00:00 [03/14/2013 19:28:50]
    Hardware
      cisco Nexus 5596 Chassis ("O2 48X10GE/Modular Supervisor")
      Intel(R) Xeon(R) CPU         with 8262944 kB of memory.
    2,N5K port
    Eth102/1/1    --                 connected 101       full    1000    --        
    Eth102/1/2    --                 connected 101       full    1000    --        
    Eth102/1/3    --                 connected 101       full    1000    --        
    Eth102/1/4    --                 connected 101       full    1000    --        
    Eth102/1/5    --                 connected 101       full    1000    --        
    Eth102/1/6    --                 connected 101       full    1000    --        
    Eth102/1/7    --                 connected 101       full    1000    --        
    Eth102/1/8    --                 connected 101       full    1000    --        
    Eth102/1/9    --                 connected 101       full    1000    --        
    Eth102/1/10   --                 connected 101       full    1000    --        
    Eth102/1/11   --                 connected 101       full    1000    --        
    Eth102/1/12   --                 connected 101       full    1000    --        
    Eth102/1/13   --                 connected 101       full    1000    --        
    Eth102/1/14   --                 connected 101       full    1000    --        
    Eth102/1/15   --                 connected 104       full    1000    --        
    Eth102/1/16   --                 connected 104       full    1000    --        
    Eth102/1/17   --                 connected 104       full    1000    --        
    Eth102/1/18   --                 connected 104       full    1000    --        
    Eth102/1/19   --                 connected 104       full    1000    --        
    Eth102/1/20   --                 connected 104       full    1000    --        
    Eth102/1/21   --                 connected 104       full    1000    --        
    Eth102/1/22   --                 connected 104       full    1000    --        
    Eth102/1/23   --                 connected 104       full    1000    --        
    Eth102/1/24   --                 connected 104       full    1000    --        
    Eth102/1/25   --                 notconnec 102       auto    auto    --        
    Eth102/1/26   --                 notconnec 102       auto    auto    --        
    Eth102/1/27   --                 connected 106       full    1000    --        
    Eth102/1/28   --                 connected 106       full    1000    --        
    Eth102/1/29   --                 connected 104       full    1000    --        
    Eth102/1/30   --                 connected 104       full    1000    --        
    Eth102/1/31   --                 connected 104       full    1000    --        
    Eth102/1/32   --                 connected 104       full    1000    --        
    Eth102/1/33   --                 connected 104       full    1000    --        
    Eth102/1/34   --                 connected 104       full    1000    --        
    Eth102/1/35   --                 connected 104       full    1000    --        
    Eth102/1/36   --                 connected 104       full    1000    --        
    Eth102/1/37   --                 connected 104       full    1000    --        
    Eth102/1/38   --                 connected 104       full    1000    --        
    Eth102/1/39   --                 notconnec 1         auto    auto    --        
    Eth102/1/40   --                 notconnec 1         auto    auto    --        
    Eth102/1/41   --                 notconnec 1         auto    auto    --        
    Eth102/1/42   --                 notconnec 1         auto    auto    --        
    Eth102/1/43   --                 notconnec 1         auto    auto    --        
    Eth102/1/44   --                 notconnec 1         auto    auto    --        
    Eth102/1/45   --                 notconnec 1         auto    auto    --        
    Eth102/1/46   --                 notconnec 1         auto    auto    --        
    Eth102/1/47   --                 notconnec 1         auto    auto    --        
    Eth102/1/48   ZTC-Switch-48      connected 105       full    100     -- 
    3,Fex
    show fex 102 det
    FEX: 102 Description: AO4-N2K-FEX102   state: Online
      FEX version: 6.0(2)N1(2) [Switch version: 6.0(2)N1(2)]
      FEX Interim version: 6.0(2)N1(2)
      Switch Interim version: 6.0(2)N1(2)
      Extender Serial: FOX1742G09B
      Extender Model: N2K-C2248TP-E-1GE,  Part No: 73-13671-02
      Card Id: 149, Mac Addr: 64:e9:50:16:08:02, Num Macs: 64
      Module Sw Gen: 21  [Switch Sw Gen: 21]
      post level: complete
      Pinning-mode: static    Max-links: 1
      Fabric port for control traffic: Eth1/3
      FCoE Admin: false
      FCoE Oper: true
      FCoE FEX AA Configured: false
      Fabric interface state:
        Po102 - Interface Up. State: Active
        Eth1/1 - Interface Up. State: Active
        Eth1/2 - Interface Up. State: Active
        Eth1/3 - Interface Up. State: Active
        Eth1/4 - Interface Up. State: Active
      Fex Port        State  Fabric Port
           Eth102/1/1    Up       Po102
           Eth102/1/2    Up       Po102
           Eth102/1/3    Up       Po102
           Eth102/1/4    Up       Po102
           Eth102/1/5    Up       Po102
           Eth102/1/6    Up       Po102
           Eth102/1/7    Up       Po102
           Eth102/1/8    Up       Po102
           Eth102/1/9    Up       Po102
          Eth102/1/10    Up       Po102
          Eth102/1/11    Up       Po102
          Eth102/1/12    Up       Po102
          Eth102/1/13    Up       Po102
          Eth102/1/14    Up       Po102
          Eth102/1/15    Up       Po102
          Eth102/1/16    Up       Po102

    show run int eth102/1/25 all
    !Command: show running-config interface Ethernet102/1/25 all
    !Time: Tue Apr 14 14:33:38 2009
    version 6.0(2)N1(2)
    interface Ethernet102/1/25
      no description
      lacp port-priority 32768
      lacp rate normal
      priority-flow-control mode auto
      lldp transmit
      lldp receive
      no switchport block unicast
      no switchport block multicast
      no hardware multicast hw-hash
      no hardware vethernet mac filtering per-vlan
      cdp enable
      switchport
      switchport mode access
      no switchport dot1q ethertype
      no switchport priority extend
      switchport access vlan 102
      spanning-tree port-priority 128
      spanning-tree cost auto
      spanning-tree link-type auto
      spanning-tree port type edge
      spanning-tree bpduguard enable
      no spanning-tree bpdufilter
      speed auto
      duplex auto
      flowcontrol receive off
      flowcontrol send on
      no link debounce
      no beacon
      delay 1
      snmp trap link-status
      logging event port link-status default
      logging event port trunk-status default
      mdix auto
      storm-control broadcast level 100.00
      storm-control multicast level 100.00
      storm-control unicast level 100.00
      no shutdown lan
      load-interval counter 1 30
      load-interval counter 2 300
      no load-interval counter 3
      medium broadcast
      channel-group 2025 mode active
      no shutdown
    show run int eth102/1/48 all
    !Command: show running-config interface Ethernet102/1/48 all
    !Time: Tue Apr 14 14:35:08 2009
    version 6.0(2)N1(2)
    interface Ethernet102/1/48
      description ZTC-Switch-48
      lacp port-priority 32768
      lacp rate normal
      priority-flow-control mode auto
      lldp transmit
      lldp receive
      no switchport block unicast
      no switchport block multicast
      no hardware multicast hw-hash
      no hardware vethernet mac filtering per-vlan
      cdp enable
      switchport
      switchport mode access
      no switchport dot1q ethertype
      no switchport priority extend
      switchport access vlan 105
      spanning-tree port-priority 128
      spanning-tree cost auto
      spanning-tree link-type auto
      spanning-tree port type edge
      spanning-tree bpduguard enable
      no spanning-tree bpdufilter
      speed auto
      duplex auto
      flowcontrol receive off
      flowcontrol send on
      no link debounce
      no beacon
      delay 1
      snmp trap link-status
      logging event port link-status default
      logging event port trunk-status default
      mdix auto
      storm-control broadcast level 100.00
      storm-control multicast level 100.00
      storm-control unicast level 100.00
      no shutdown lan
      load-interval counter 1 30
      load-interval counter 2 300
      no load-interval counter 3
      medium broadcast
      no shutdown
    Ports are connected, there is no relationship with the speed option, such as port 102/1/1 is connected, but no speed option, port 102/1/47 is notconnected, there speed options.
    show int eth102/1/1
    Ethernet102/1/1 is up
      Belongs to Po2001
      Hardware: 100/1000 Ethernet, address: 64e9.5016.0802 (bia 64e9.5016.0802)
      MTU 1500 bytes, BW 1000000 Kbit, DLY 10 usec
      reliability 255/255, txload 1/255, rxload 1/255
      Encapsulation ARPA
      Port mode is access
      full-duplex, 1000 Mb/s
      Beacon is turned off
      Input flow-control is off, output flow-control is on
      Switchport monitor is off
      EtherType is 0x8100
      Last link flapped 1d02h
    int eth102/1/1
    (config-if)# ?
      beacon          Disable/enable the beacon for an interface
      cdp             Configure CDP interface parameters
      channel-group   Configure port channel parameters
      description     Enter description of maximum 80 characters
      inherit         Inherit a port-profile
      ip              Configure IP features
      ipv6            Configure IPv6 features
      lacp            Configure LACP parameters
      link            Configure link
      lldp            Configure Interface LLDP parameters
      logging         Configure logging for interface
      mvr-group       MVR interface config
      mvr-type        MVR interface config
      mvr-vlan        Interface MVR Config
      no              Negate a command or set its defaults
      rate-limit      Set packet per second rate limit
      service-policy  Configure service policy for an interface
      service-policy  Policy Map
      shutdown        Enable/disable an interface
      snmp            Modify SNMP interface parameters
      spanning-tree   Spanning Tree Subsystem
      switchport      Configure switchport parameters
      untagged        Default to use for untagged packets on interface
      end             Go to exec mode
      exit            Exit from command interpreter
      pop             Pop mode from stack or restore from name
      push            Push current mode to stack or save it under name
      where           Shows the cli context you are in
    show int eth102/1/47
    Ethernet102/1/47 is down (Link not connected)
      Hardware: 100/1000 Ethernet, address: 64e9.5016.0830 (bia 64e9.5016.0830)
      MTU 1500 bytes, BW 0 Kbit, DLY 10 usec
      reliability 255/255, txload 1/255, rxload 1/255
      Encapsulation ARPA
      Port mode is access
      auto-duplex, auto-speed
      Beacon is turned off
      Input flow-control is off, output flow-control is on
      Switchport monitor is off
      EtherType is 0x8100
    int eth102/1/47
    (config-if)# ?
      bandwidth              Set bandwidth informational parameter
      beacon                 Disable/enable the beacon for an interface
      cdp                    Configure CDP interface parameters
      channel-group          Configure port channel parameters
      default                Set a command to its defaults
      delay                  Specify interface throughput delay
      description            Enter description of maximum 80 characters
      duplex                 Enter the port duplex mode
      fex                    Configure FEX fabric
      flowcontrol            Configure interface flowcontrol
      hardware               FEX Card type
      inherit                Inherit a port-profile
      ip                     Configure IP features
      ipv6                   Configure IPv6 features
      lacp                   Configure LACP parameters
      link                   Configure link
      lldp                   Configure Interface LLDP parameters
      load-interval          Specify interval for load calculation for an interface
      logging                Configure logging for interface
      mac                    MAC
      mac-address            Configure interface mac address
      mvr-group              MVR interface config
      mvr-type               MVR interface config
      mvr-vlan               Interface MVR Config
      negotiate              Configure link negotiation parameters
      no                     Negate a command or set its defaults
      priority-flow-control  Enable/Disable PFC
      rate-limit             Set packet per second rate limit
      service-policy         Configure service policy for an interface
      service-policy         Policy Map
      shutdown               Enable/disable an interface
      snmp                   Modify SNMP interface parameters
      spanning-tree          Spanning Tree Subsystem
      speed                  Enter the port speed
      storm-control          Configure Interface storm control
      switchport             Configure switchport parameters
      untagged               Default to use for untagged packets on interface
      vpc                    Virtual Port Channel configuration
      vtp                    Enable VTP on this interface
      end                    Go to exec mode
      exit                   Exit from command interpreter
      pop                    Pop mode from stack or restore from name
      push                   Push current mode to stack or save it under name
      where                  Shows the cli context you are in

Maybe you are looking for