GNU/Linux and opensource news gathered

http://linux.feeder.ww7.be
«  septembre 2017
lundi mardi mercredi jeudi vendredi samedi dimanche
28 29 30 31 1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 1
retour à la date courante

Aujourd'hui 10 nouvelles :


  • Cut the strings from end, par sdosanjh, 7 septembre 2017

    jeudi 7 septembre 2017 :: The UNIX and Linux Forums :: RSS
    could you please help me.
    I have below autosys jobs

    Code:

    01_enable_input_hol_dtpz1b
    01_abc_copy_ld_sat_xxxz1
    01_abc_mavcd_yyyyyxxxz1
    01_abcdef_oa_xxxxxz1
    01_fdgte_symbol_ddddz1
    01_fsdfsd_clean_mmmhhhfz1
    01_fsdfd_create_mut_marchtz1

    I want to remove name after last "_" underscore
    so that I get
    Code:

    01_enable_input_hol
    001_abc_copy_ld_sat
    01_abc_mavcd
    01_abcdef_oa
    01_fdgte_symbol
    01_fsdfsd_clean
    01_fsdfd_create_mut


    I tried the awk using substr but not able to display required output
    because these names can be long or short depending on the setup

    Code:

    cat abc.1 | awk '{print substr($0, length($0)-7)}'
    Lire la suite sdosanjh
  • Invalid Java installation: No version could be obtained, par Riverstone, 7 septembre 2017

    jeudi 7 septembre 2017 :: The UNIX and Linux Forums :: RSS
    Hi ,
    i am in mid of upgrading one of the java based application which requires higher version of java 1.8 from java 1.6, I have updated bash_profile and required environment variable correctly but still application unable to obtain the required version of java 1.8.

    here is my environment detail
    Code:

    echo $PATH
    /usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/oraclient/app/oracli/product/11.2.0/client_1/bin:/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.121-0.b13.el7_3.x86_64

    Code:

    echo $JAVA_HOME
    /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.121-0.b13.el7_3.x86_64

    but still application unable to find the java version as per below error

    Code:

    Java Home Directory (Must point to Java 1.8 directory) (DEFAULT:
      /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.121-0.b13.el7_3.x86_64/): /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.121-0.b13.el7_3.x86_64/

    Java Home Directory (Must point to Java 1.8 directory):
    Invalid Java installation: No version could be obtained

    Please find the below directory structure :
    Please find the below java directory structure

    Code:

    $cd /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.121-0.b13.el7_3.x86_64/

     java-1.8.0-openjdk-1.8.0.121-0.b13.el7_3.x86_64]$ls -lrt
    total 50728
    -rw-r--r--  1 root root 51935439 Jan 16  2017 src.zip
    drwxr-xr-x  4 root root      26 Feb  8  2017 jre
    drwxr-xr-x  2 root root    4096 Feb  8  2017 bin
    drwxr-xr-x  3 root root      125 Feb  8  2017 include
    drwxr-xr-x  3 root root      135 Feb  8  2017 lib
    drwxr-xr-x  2 root root    4096 Feb  8  2017 tapset
    drwxr-xr-x 10 root root      125 Feb  8  2017 demo
    drwxr-xr-x 11 root root      152 Feb  8  2017 sample

    java-1.8.0-openjdk-1.8.0.121-0.b13.el7_3.x86_64]$cd bin/

    ls -lrt
    total 420
    -rwxr-xr-x 1 root root  2806 Jan 16  2017 java-rmi.cgi
    -rwxr-xr-x 1 root root  7384 Jan 16  2017 xjc
    -rwxr-xr-x 1 root root  7392 Jan 16  2017 wsimport
    -rwxr-xr-x 1 root root  7384 Jan 16  2017 wsgen
    -rwxr-xr-x 1 root root 103424 Jan 16  2017 unpack200
    -rwxr-xr-x 1 root root  7464 Jan 16  2017 tnameserv
    -rwxr-xr-x 1 root root  7392 Jan 16  2017 servertool
    -rwxr-xr-x 1 root root  7392 Jan 16  2017 serialver
    -rwxr-xr-x 1 root root  7392 Jan 16  2017 schemagen
    -rwxr-xr-x 1 root root  7392 Jan 16  2017 rmiregistry
    -rwxr-xr-x 1 root root  7384 Jan 16  2017 rmid
    -rwxr-xr-x 1 root root  7384 Jan 16  2017 rmic
    -rwxr-xr-x 1 root root  7400 Jan 16  2017 policytool
    -rwxr-xr-x 1 root root  7392 Jan 16  2017 pack200
    -rwxr-xr-x 1 root root  7456 Jan 16  2017 orbd
    -rwxr-xr-x 1 root root  7400 Jan 16  2017 native2ascii
    -rwxr-xr-x 1 root root  7392 Jan 16  2017 keytool
    -rwxr-xr-x 1 root root  7384 Jan 16  2017 jstatd
    -rwxr-xr-x 1 root root  7384 Jan 16  2017 jstat
    -rwxr-xr-x 1 root root  7456 Jan 16  2017 jstack
    -rwxr-xr-x 1 root root  7408 Jan 16  2017 jsadebugd
    -rwxr-xr-x 1 root root  7392 Jan 16  2017 jrunscript
    -rwxr-xr-x 1 root root  7384 Jan 16  2017 jps
    -rwxr-xr-x 1 root root  7448 Jan 16  2017 jmap
    -rwxr-xr-x 1 root root  7384 Jan 16  2017 jjs
    -rwxr-xr-x 1 root root  7448 Jan 16  2017 jinfo
    -rwxr-xr-x 1 root root  7384 Jan 16  2017 jhat
    -rwxr-xr-x 1 root root  7384 Jan 16  2017 jdeps
    -rwxr-xr-x 1 root root  7400 Jan 16  2017 jdb
    -rwxr-xr-x 1 root root  7408 Jan 16  2017 jconsole
    -rwxr-xr-x 1 root root  7384 Jan 16  2017 jcmd
    -rwxr-xr-x 1 root root  7384 Jan 16  2017 javap
    -rwxr-xr-x 1 root root  7384 Jan 16  2017 javah
    -rwxr-xr-x 1 root root  7392 Jan 16  2017 javadoc
    -rwxr-xr-x 1 root root  7384 Jan 16  2017 javac
    -rwxr-xr-x 1 root root  7336 Jan 16  2017 java
    -rwxr-xr-x 1 root root  7392 Jan 16  2017 jarsigner
    -rwxr-xr-x 1 root root  7384 Jan 16  2017 jar
    -rwxr-xr-x 1 root root  7384 Jan 16  2017 idlj
    -rwxr-xr-x 1 root root  7392 Jan 16  2017 extcheck
    -rwxr-xr-x 1 root root  7400 Jan 16  2017 appletviewer

    $cd java
    java          javac        javadoc      javah        javap        java-rmi.cgi

    anything else needs to setup, how application unable to find the java version though it is there.

    Code:

    /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.121-0.b13.el7_3.x86_64/jre/bin/java

     bin]#pwd
    /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.121-0.b13.el7_3.x86_64/jre/bin

     bin]#java -version
    openjdk version "1.8.0_121"
    OpenJDK Runtime Environment (build 1.8.0_121-b13)
    OpenJDK 64-Bit Server VM (build 25.121-b13, mixed mode)

    Lire la suite Riverstone
  • Rearrange fields of delimited text file, par andy2000, 7 septembre 2017

    jeudi 7 septembre 2017 :: The UNIX and Linux Forums :: RSS
    I want to rearrange the fields of delimited text file after sorting first line (only):

    input file:

    Code:

    a_13;a_2;a_1;a_10
    13;2;1;10

    the result should be:

    Code:

    a_1;a_2;a_10;a_13
    1;2;10;13

    any help would be appreciated

    andy
    Lire la suite andy2000
  • SMA (Single Moving Average) and Standard Deviation, par csierra, 7 septembre 2017

    jeudi 7 septembre 2017 :: The UNIX and Linux Forums :: RSS
    Hello Team,

    I am using the following awk script to calculate the SMA (Single Moving Average) for an specific period but now I would like to include the standard deviation output.

    Could you please help me to modify this awk shell script


    Code:

    awk -F, -v points=5 '  {  a[NR % points] = $2;    if(NR>=points) {  total_a = 0;    for (i = 0; i < points; ++i)      { total_a = total_a + a[i]; }        print ($1, $2, total_a/points);  }  }' data.csv
    Input Data
    Code:

    Row    Data
    1    10.09
    2    10.14
    3    10.02
    4    10.13
    5    10.1
    6    10.06
    7    10.15
    8    9.91
    9    9.99
    10    9.72
    11    9.75
    12    9.57
    13    9.62
    14    9.97
    15    9.71
    16    9.77
    17    9.88
    18    9.71
    19    9.75
    20    9.53
    21    9.46
    22    9.38
    23    9.63
    24    9.67
    25    9.92
    26    10.04

    Expected Output:

    Code:

    Row    Data    SMA 5    Standard Deviation 5 Period
    5    10.1    10.096    0.042237424
    6    10.06    10.09    0.04472136
    7    10.15    10.092    0.047074409
    8    9.91    10.07    0.085556999
    9    9.99    10.042    0.084237759
    10    9.72    9.966    0.146232691
    11    9.75    9.904    0.158442419
    12    9.57    9.788    0.147837749
    13    9.62    9.73    0.145464772
    14    9.97    9.726    0.138361844
    15    9.71    9.724    0.138506318
    16    9.77    9.728    0.139484766
    17    9.88    9.79    0.123450395
    18    9.71    9.808    0.102058807
    19    9.75    9.764    0.062481997
    20    9.53    9.728    0.113912247
    21    9.46    9.666    0.152131522
    22    9.38    9.566    0.142632395
    23    9.63    9.55    0.129460419
    24    9.67    9.534    0.106695829
    25    9.92    9.612    0.187339264
    26    10.04    9.728    0.231637648


    Attached Files
    File Type: xls data.xls (28.5 KB)
    File Type: xls standard_deviation.xls (29.5 KB)
    Lire la suite csierra
  • Combining certain columns of multiple files into one file, par ksennin, 7 septembre 2017

    jeudi 7 septembre 2017 :: The UNIX and Linux Forums :: RSS
    Hello Unix gurus,

    I have a large number of files (say X) each containing two columns of data and the same number of rows.

    I would like to combine these files to create a unique merged file containing X columns corresponding to the second column of each file (with a bonus of having the first column of the first file only as a first column of the merged file).

    I have only started recently to use bash scripting to try and do this, so I am quite new to this, but I have been trying "paste", or even "pr" as below:
    Code:

    Not the actual code ("..." signify a long list of file names or columns):

    pr -m -t -s\  file1 file2 file3 [...] fileX | gawk '{print $1,$2,$4,$6,$8,[...],$X }' > merged.file

    I don't really know what I am doing wrong, but when I don't get an error message ("pr: page width too narrow") it is insanely slow, even on a machine with loads of RAM. Would there be a better way to do this basic transformation?

    Many thanks for your help and your time!

    KS
    Lire la suite ksennin
  • How to remove contents from file which are under bracket?, par ghpradeep, 7 septembre 2017

    jeudi 7 septembre 2017 :: The UNIX and Linux Forums :: RSS
    hello Friend,

    In hostgroup file, i have define lots of hostgroups. I need to remove few of them without manually editing file. Need script or syntax.
    I want to search particular on hostgroup_members and delete hostgoup defination of it.

    for example.
    Code:

    define hostgroup{
            hostgroup_name          test
            alias                  test server
          hostgroup_members      test-server
    }
    define hostgroup{
            hostgroup_name          prd
            alias                  Prd server
          hostgroup_members      prd-server
    }
    define hostgroup{
            hostgroup_name          acc
            alias                  acc server
          hostgroup_members      acc-server
    }

    for example: suppose i delete prd-server hostgroup_members then my output will be below.
    Code:

    define hostgroup{
            hostgroup_name          test
            alias                  test server
          hostgroup_members      test-server
    }
    define hostgroup{
            hostgroup_name          acc
            alias                  acc server
          hostgroup_members      acc-server
    }



    Moderator's Comments:
    Please wrap all code, files, input & output/errors in CODE tags.
    It makes it easier to read and preserves multiple spaces for indenting or fixed width data.
    Lire la suite ghpradeep
  • Extract n-digits from string in perl, par james2009, 7 septembre 2017

    jeudi 7 septembre 2017 :: The UNIX and Linux Forums :: RSS
    Hello,

    I have a log file with logs such as
    Code:

    01/05/2017 10:23:41 [ABCD-22357$0]: file.log.38: database error, MODE=SINGLE, LEVEL=critical, STATE: 01170255 (mode main
    how can i use perl to extract the 8-digit number below from the string
    Code:

    01170255
    Thanks
    Lire la suite james2009
  • Order of data in Spool File, par Aparna.N, 7 septembre 2017

    jeudi 7 septembre 2017 :: The UNIX and Linux Forums :: RSS
    Hello,

    I have a shell script through which I am executing .sql file and spooling the result of Query from .sql . I want to spool the result in ascending order. Is there any parameter to be set to print result in ascending or descending order.

    Thanks in advance.
    Lire la suite Aparna.N
  • Help with Script using awk, par dakelly, 7 septembre 2017

    jeudi 7 septembre 2017 :: The UNIX and Linux Forums :: RSS
    Hi All,

    I need to create a script to look at a very long list of files, and look inside these files for a specific number of a special character "," there needs to be no more than 14 in each line in each file.

    I have copied 2 files for testing the script.

    Code:

    dk@server: /export/home/test> ls -alt DK* | awk '{ print $9 }'
    DK_TEST2.dat
    DK_TEST.dat
    dk@server: /export/home/test>

    these files look something like this (not exact content, but close - to protect data)
    Code:

    ,,30035111,DAVY KELLY JOB NO. 17748000,16940000,04/09/2017,04/09/2017,P001111,10.2,10,1.02,Davy Kelly,1,,
    ,,30035111,DAVY KELLY JOB NO. 17748000,16940000,04/09/2017,04/09/2017,P001111,13.62,6,2.27,Davy Kelly,2,,
    ,,30035111,DAVY KELLY JOB NO. 17748000,16940000,04/09/2017,04/09/2017,P029111,16.91,1,16.91,Davy Kelly,3,,
    ,,30035111,DAVY KELLY JOB NO. 17748000,16940000,04/09/2017,04/09/2017,P029111,16.91,1,16.91,Davy Kelly,4,

    I am looking to:
    make a list of the filenames in the path that contain DK* save as LIST
    for each FILE in LIST
    Check via AWK for more than 14 commas - if true print FILENAME to OUTPUT file
    mail out OUTPUT file to myself.

    Code:

    #!/bin/sh
    ###
    ###  Name:        check_excesiveComma.sh
    ###  Path:          /export/home/test
    ###  Description:  Copy a list of Filenames that have more than 14 commas
    ###  Version:      1.1
    ###  Author:      DKelly
    ###

    FPATH=/export/home/test
    DAT=`date`
    MSG=/tmp/email.txt
    OUTPUT=/tmp/output.txt
    LIST=/tmp/list.txt

    touch $LIST
    ls -alt DK* | awk '{ print $9 }' >> $LIST

    ###  Change Directory to $FPATH
    cd $FPATH

    ###  Check all files for more than 14 commas and output the filenams
    for FILE in $LIST
    do
        if (`awk 'BEGIN -F"," {NF > 14}`) then echo $FILE >> $OUTPUT
    done

    ###  Mail out the message and delete the output and message
    cat $MSG | /usr/bin/mailx -s"Graftons Files that might cause issues" davy

    ###  remove files.
    rm $MSG
    rm $LIST
    rm $OUTPUT

    ###  end script

    Don't worry I know I have a variable for MSG and this is really the one i want to email...

    I am not really getting AWK very well... I need to look in the each file in the List, count each line for commas, and echo out the Actual Filename if one of the lines has more than 14 commas.

    Please could you kind people point me in the right direction.

    davy
    Lire la suite dakelly
  • Cook: Security things in Linux v4.13, par corbet, 7 septembre 2017

    jeudi 7 septembre 2017 :: LWN.net :: RSS
    Kees Cook highlights the security-related changes in the 4.13 kernel. "Daniel Micay created a version of glibc’s FORTIFY_SOURCE compile-time and run-time protection for finding overflows in the common string (e.g. strcpy, strcmp) and memory (e.g. memcpy, memcmp) functions. The idea is that since the compiler already knows the size of many of the buffer arguments used by these functions, it can already build in checks for buffer overflows. When all the sizes are known at compile time, this can actually allow the compiler to fail the build instead of continuing with a proven overflow. When only some of the sizes are known (e.g. destination size is known at compile-time, but source size is only known at run-time) run-time checks are added to catch any cases where an overflow might happen. Adding this found several places where minor leaks were happening, and Daniel and I chased down fixes for them."
    Lire la suite corbet