Find the answer to your Linux question:
Results 1 to 6 of 6
hi all , my file looks something like this.. [File name] ***** [File Rev] 1.0 [Date] 21,July 2008 [Source] jsvbhjbv [Notes] ****** time typ min max 6 9697nS 1.7997V 1.6486V ...
  1. #1
    Just Joined!
    Join Date
    Jan 2009
    Posts
    12

    script for matching points..

    hi all ,
    my file looks something like this..
    [File name] *****
    [File Rev] 1.0
    [Date] 21,July 2008
    [Source] jsvbhjbv
    [Notes] ******
    time typ min max
    6 9697nS 1.7997V 1.6486V 1.9499V
    7.2727nS 1.7997V 1.6488V 1.9499V
    7.5758nS 1.7998V 1.6489V 1.9499V
    7.8788nS 1.7998V 1.6491V 1.9499V
    8.1818nS 1.7998V 1.6492V 1.9499V
    8.4848nS 1.7998V 1.6493V 1.9499V
    8.7879nS 1.7999V 1.6494V 1.9500V
    9.0909nS 1.7999V 1.6494V 1.9500V
    9.3939nS 1.7999V 1.6495V 1.9500V
    9.6970nS 1.7999V 1.6496V 1.9500V
    10.0000nS 1.7999V 1.6496V 1.9500V
    10.3030nS 1.7999V 1.6497V 1.9500V

    i need a simple perl or awk script that would give the time stamp at which all the three typ min and max values match...

    eg.output something like this
    8.7879nS 1.7999V 1.6494V 1.9500V
    9.0909nS 1.7999V 1.6494V 1.9500V
    9.6970nS 1.7999V 1.6496V 1.9500V
    10.0000nS 1.7999V 1.6496V 1.9500V

    thanks

  2. #2
    tpl
    tpl is offline
    Linux User
    Join Date
    Jan 2007
    Location
    cleveland
    Posts
    452
    if you want all 3 to match, why do you have

    9.6970nS 1.7999V 1.6496V 1.9500V
    10.0000nS 1.7999V 1.6496V 1.9500V

    on the list? The middle value doesn't match.

    anyway, try

    grep "<value1> <value2> <value3>" <filename>

    e.g.

    grep "1.7999V 1.6494V 1.9500V" ****
    the sun is new every day (heraclitus)

  3. #3
    Just Joined!
    Join Date
    Jan 2009
    Posts
    12

    match..

    i guess you haven't understood what i meant...

    i need the time stamps at which the typ min and max values of two or more consecutve rows have the same typ min values..
    9.6970nS 1.7999V 1.6496V 1.9500V
    10.0000nS 1.7999V 1.6496V 1.9500V
    like the one here since the time 9.6970nS and 10.000ns have the same values in their typ min max column.
    i can delete one of them....

    so i need a script that would give the time values at which the redundancy of all the three with the previous time occurs....

  4. #4
    drl
    drl is offline
    Linux Engineer drl's Avatar
    Join Date
    Apr 2006
    Location
    Saint Paul, MN, USA / CentOS, Debian, Solaris, SuSE
    Posts
    1,117
    Hi.

    This can be done with standard commands:
    Code:
    #!/usr/bin/env bash
    
    # @(#) s1       Eliminating consecutive lines with duplicate character fields.
    
    echo
    set +o nounset
    LC_ALL=C ; LANG=C ; export LC_ALL LANG
    echo "Environment: LC_ALL = $LC_ALL, LANG = $LANG"
    echo "(Versions displayed with local utility \"version\")"
    version >/dev/null 2>&1 && version "=o" $(_eat $0 $1) grep uniq
    set -o nounset
    echo
    
    FILE=${1-data1}
    
    echo " Data file $FILE:"
    cat $FILE
    
    # Keep lines beginning with numeric, remove duplicates with
    # identical strings in fields 2-end of line.
    
    echo
    echo " Results:"
    grep '^[0-9]' $FILE |
    uniq --skip-fields=1
    
    exit 0
    Producing:
    Code:
    % ./s1
    
    Environment: LC_ALL = C, LANG = C
    (Versions displayed with local utility "version")
    OS, ker|rel, machine: Linux, 2.6.11-x1, i686
    Distribution        : Xandros Desktop 3.0.3 Business
    GNU bash 2.05b.0
    grep (GNU grep) 2.5.1
    uniq (coreutils) 5.2.1
    
     Data file data1:
    [File name] *****
    [File Rev] 1.0
    [Date] 21,July 2008
    [Source] jsvbhjbv
    [Notes] ******
    time typ min max
    6 9697nS 1.7997V 1.6486V 1.9499V
    7.2727nS 1.7997V 1.6488V 1.9499V
    7.5758nS 1.7998V 1.6489V 1.9499V
    7.8788nS 1.7998V 1.6491V 1.9499V
    8.1818nS 1.7998V 1.6492V 1.9499V
    8.4848nS 1.7998V 1.6493V 1.9499V
    8.7879nS 1.7999V 1.6494V 1.9500V
    9.0909nS 1.7999V 1.6494V 1.9500V
    9.3939nS 1.7999V 1.6495V 1.9500V
    9.6970nS 1.7999V 1.6496V 1.9500V
    10.0000nS 1.7999V 1.6496V 1.9500V
    10.3030nS 1.7999V 1.6497V 1.9500V
    
     Results:
    6 9697nS 1.7997V 1.6486V 1.9499V
    7.2727nS 1.7997V 1.6488V 1.9499V
    7.5758nS 1.7998V 1.6489V 1.9499V
    7.8788nS 1.7998V 1.6491V 1.9499V
    8.1818nS 1.7998V 1.6492V 1.9499V
    8.4848nS 1.7998V 1.6493V 1.9499V
    8.7879nS 1.7999V 1.6494V 1.9500V
    9.3939nS 1.7999V 1.6495V 1.9500V
    9.6970nS 1.7999V 1.6496V 1.9500V
    10.3030nS 1.7999V 1.6497V 1.9500V
    See man grep and man uniq for details ... cheers, drl
    Welcome - get the most out of the forum by reading forum basics and guidelines: click here.
    90% of questions can be answered by using man pages, Quick Search, Advanced Search, Google search, Wikipedia.
    We look forward to helping you with the challenge of the other 10%.
    ( Mn, 2.6.n, AMD-64 3000+, ASUS A8V Deluxe, 1 GB, SATA + IDE, Matrox G400 AGP )

  5. #5
    Just Joined!
    Join Date
    Jan 2009
    Posts
    12

    scipt not working

    hey thanks for the reply...
    but can i get the script in perl or awk...it would be easy for me to understand.

  6. #6
    drl
    drl is offline
    Linux Engineer drl's Avatar
    Join Date
    Apr 2006
    Location
    Saint Paul, MN, USA / CentOS, Debian, Solaris, SuSE
    Posts
    1,117
    Hi.

    In reviewing your other recent posts, and considering your request for such a particular solution, it looks like you are posting coursework questions.

    If so, you need to be aware that such questions are not allowed here -- see http://www.linuxforums.org/forum/lin...ums-rules.html

    Good luck ... cheers, drl
    Welcome - get the most out of the forum by reading forum basics and guidelines: click here.
    90% of questions can be answered by using man pages, Quick Search, Advanced Search, Google search, Wikipedia.
    We look forward to helping you with the challenge of the other 10%.
    ( Mn, 2.6.n, AMD-64 3000+, ASUS A8V Deluxe, 1 GB, SATA + IDE, Matrox G400 AGP )

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...