• ALGEMENE VOORWAARDEN
  • GENERAL TERMS & CONDITIONS

KUDOS - IT consultant and FOSS supporter

  • home
  • contact
  • services
  • baanboard
  • msx
Home

Feed aggregator

Help me to command to output file format.

UNIX.com - Tue, 07/09/2010 - 17:10
Dear Master.

Help me to command to out put.

Ex log.
Code: "<?xml version=""1.0"" encoding=""UTF-10"" ?><anova-test-bom>
  <txid>17251032659</txid>
  <authentication>
    <user>admin</user>
    <password>Amrduoi</password>
  </authentication>
  <destination>
    <msisdn>1111111</msisdn>
    <serviceid>1111111</serviceid>
  </destination>
  <originator>
    <mobi>123456724748274</msisdn>
  </originator>
  <message>
    <header>
      <timestamp>20100903154543</timestamp>
    </header>
    <sms>
      <msg>M</msg>
      <msgtype>E</msgtype>
      <encoding>0</encoding>
    </sms>
  </message>
  <startCallDateTime>20100903154543</startCallDateTime>
</anova-test-bom>"
"<?xml version=""1.0"" encoding=""UTF-10"" ?><anova-test-bom>
  <txid>17251032880</txid>
  <authentication>
    <user>admin</user>
    <password>Amrduoi</password>
  </authentication>
  <destination>
    <msisdn>1111111</msisdn>
    <serviceid>1111111</serviceid>
  </destination>
  <originator>
    <mobi>123456704470545</msisdn>
  </originator>
  <message>
    <header>
      <timestamp>20100903154545</timestamp>
    </header>
    <sms>
      <msg>M</msg>
      <msgtype>E</msgtype>
      <encoding>0</encoding>
    </sms>
  </message>
  <startCallDateTime>20100903154545</startCallDateTime>
</anova-test-bom>"
"<?xml version=""1.0"" encoding=""UTF-10"" ?><anova-test-bom>
  <txid>17251034752</txid>
  <authentication>
    <user>admin</user>
    <password>Amrduoi</password>
  </authentication>
  <destination>
    <msisdn>2222222</msisdn>
    <serviceid>2222222</serviceid>
  </destination>
  <originator>
    <mobi>123456744075149</msisdn>
  </originator>
  <message>
    <header>
      <timestamp>20100903154457</timestamp>
    </header>
    <sms>
      <msg></msg>
      <msgtype>E</msgtype>
      <encoding>0</encoding>
    </sms>
  </message>
  <startCallDateTime>20100903154457</startCallDateTime>
</anova-test-bom>"
"<?xml version=""1.0"" encoding=""UTF-10"" ?><anova-test-bom>
  <txid>17251037535</txid>
  <authentication>
    <user>admin</user>
    <password>Amrduoi</password>
  </authentication>
  <destination>
    <msisdn>3333333</msisdn>
    <serviceid>3333333</serviceid>
  </destination>
  <originator>
    <mobi>123456769969117</msisdn>
  </originator>
  <message>
    <header>
      <timestamp>20100903154521</timestamp>
    </header>
    <sms>
      <msg>D</msg>
      <msgtype>E</msgtype>
      <encoding>0</encoding>
    </sms>
  </message>
  <startCallDateTime>20100903154521</startCallDateTime>
</anova-test-bom>"
"<?xml version=""1.0"" encoding=""UTF-10"" ?><anova-test-bom>
  <txid>17251037655</txid>
  <authentication>
    <user>Amrdu</user>
    <password>1234Test</password>
  </authentication>
  <destination>
    <msisdn>4444444</msisdn>
    <serviceid>4444444</serviceid>
  </destination>
  <originator>
    <mobi>123456781540765</msisdn>
  </originator>
  <message>
    <header>
      <timestamp>20100903154522</timestamp>
    </header>
    <sms>
      <msg>R</msg>
      <msgtype>E</msgtype>
      <encoding>0</encoding>
    </sms>
  </message>
  <startCallDateTime>20100903154522</startCallDateTime>
</anova-test-bom>"
"<?xml version=""1.0"" encoding=""UTF-10"" ?><anova-test-bom>
  <txid>17251037848</txid>
  <authentication>
    <user>admin</user>
    <password>Amrduoi</password>
  </authentication>
  <destination>
    <msisdn>3333333</msisdn>
    <serviceid>3333333</serviceid>
  </destination>
  <originator>
    <mobi>123456768454593</msisdn>
  </originator>
  <message>
    <header>
      <timestamp>20100903154524</timestamp>
    </header>
    <sms>
      <msg>D</msg>
      <msgtype>E</msgtype>
      <encoding>0</encoding>
    </sms>
  </message>
  <startCallDateTime>20100903154524</startCallDateTime>
</anova-test-bom>"
"<?xml version=""1.0"" encoding=""UTF-10"" ?><anova-test-bom>
  <txid>17251039455</txid>
  <authentication>
    <user>Amrdu</user>
    <password>1234Test</password>
  </authentication>
  <destination>
    <msisdn>4444444</msisdn>
    <serviceid>5555555</serviceid>
  </destination>
  <originator>
    <mobi>123456714329185</msisdn>
  </originator>
  <message>
    <header>
      <timestamp>20100903154536</timestamp>
    </header>
    <sms>
      <msg>A</msg>
      <msgtype>E</msgtype>
      <encoding>0</encoding>
    </sms>
  </message>
  <startCallDateTime>20100903154536</startCallDateTime>
</anova-test-bom>"
"<?xml version=""1.0"" encoding=""UTF-10"" ?><anova-test-bom>
  <txid>17251040120</txid>
  <authentication>
    <user>admin</user>
    <password>Amrduoi</password>
  </authentication>
  <destination>
    <msisdn>1925532</msisdn>
    <serviceid>6666666</serviceid>
  </destination>
  <originator>
    <mobi>123456769505122</msisdn>
  </originator>
  <message>
    <header>
      <timestamp>20100903154540</timestamp>
    </header>
    <sms>
      <msg>A</msg>
      <msgtype>E</msgtype>
      <encoding>0</encoding>
    </sms>
  </message>
  <startCallDateTime>20100903154540</startCallDateTime>
</anova-test-bom>"
"<?xml version=""1.0"" encoding=""UTF-10"" ?><anova-test-bom>
  <txid>17251040593</txid>
  <authentication>
    <user>Amrdu</user>
    <password>1234Test</password>
  </authentication>
  <destination>
    <msisdn>4444444</msisdn>
    <serviceid>4444444</serviceid>
  </destination>
  <originator>
    <mobi>123456781540765</msisdn>
  </originator>
  <message>
    <header>
      <timestamp>20100903154544</timestamp>
    </header>
    <sms>
      <msg>R</msg>
      <msgtype>E</msgtype>
      <encoding>0</encoding>
    </sms>
  </message>
  <startCallDateTime>20100903154544</startCallDateTime>
</anova-test-bom>"
"<?xml version=""1.0"" encoding=""UTF-10"" ?><anova-test-bom>
  <txid>17251041433</txid>
  <authentication>
    <user>admin</user>
    <password>Amrduoi</password>
  </authentication>
  <destination>
    <msisdn>3333333</msisdn>
    <serviceid>3333333</serviceid>
  </destination>
  <originator>
    <mobi>1234567882795</msisdn>
  </originator>
  <message>
    <header>
      <timestamp>20100903154550</timestamp>
    </header>
    <sms>
      <msg>D</msg>
      <msgtype>E</msgtype>
      <encoding>0</encoding>
    </sms>
  </message>
  <startCallDateTime>20100903154550</startCallDateTime>
</anova-test-bom>"
I want out put format.

Code: <msg>M</msg> <msgtype>E</msgtype> <encoding>0</encoding>
<msg>M</msg> <msgtype>E</msgtype> <encoding>0</encoding>
.
.
.
.
<msg>D</msg> <msgtype>E</msgtype> <encoding>0</encoding> .


Help me please.
Thank YOU.

Moderator's Comments: Please reduce the relevant files to some relevant part and post this part here (between CODE-tags, please!). Our users are not supposed to have to download anything from third-party-sources just to solve your problem. Thanks for your consideration.

Configuration Information tools

UNIX.com - Tue, 07/09/2010 - 17:09
Hi All;

I was exploring options of setting up a centralized configuration information respository which could be managed by a GUI/Web.I have around 100+ servers all running linux (mostly redhat).I tried the Apache/Mysql/Script based approach,unfortunately I do not have the time/experstise to do it.

Is there any free tool for achieving the task.

Thanks in Advance

Changing the sender Email address to Alias

UNIX.com - Tue, 07/09/2010 - 17:05
Hi All,

I want to change the email address of the sender to some alias
for eg:

FROM:noreplyecommerce@test.com needs to be changes to TEST

Please help me.

Emulate ksh's FPATH variable in bash

UNIX.com - Tue, 07/09/2010 - 17:01
Over time i have developed a library of useful (ksh) functions which i use in most of my scripts. I use the ksh's FPATH variable to locate all these functions and use a standard environment-setting-function to always have the same environment in all my scripts.

Here is how i begin scripts:

Code: #!/bin/ksh
# foo.ksh

# main()

if [ -z "$DEVELOP" ] ; then                      # set environment
    . /usr/local/lib/ksh/f_env
else
    . ~/lib/f_env
fi

# ... rest of code .... $DEVELOP is a variable i set if i want to use a local copy of the function library for testing purposes. "/usr/local/lib/ksh/f_env" looks like this:

Code: if [ -z "$NEVER_USE_THIS_VAR" ] ; then          # recursion protection
    # .... some more settings ...

    if [ -z "$DEVELOP" ] ; then
          typeset -x FPATH="/usr/local/lib/ksh"  # set fnc path for fnc lib
          FPATH="$FPATH:/usr/local/bin"
          FPATH="$FPATH:/usr/local/sbin"
    else
          typeset -x FPATH=~/lib                # for lib development
    fi

    # ...
    typeset -x NEVER_USE_THIS_VAR="KILROY_WAS_HERE"
fi This mechanism is quite handy because many functions in the library depend on other functions in the same library and this way all these depencies are solved automatically.

I would like to make this library compatible with the bash shell (ideally i would be able to use these functions from ksh and bash equally), but bash lacks the FPATH mechanism. I came up with the following solution, but obviously it is quite unsatisfactory and i wonder if there is a better way to achieve my goal:

(within f_env(), after setting the FPATH variable: )

Code:                                                 # simulate FPATH for bash
    if [ -n "$BASH_VERSION" ] ; then
          IFS=:
          for fFPathDir in $FPATH ; do
              for fFFile in $fFPathDir/* ; do
                    if [ $( \
                            sed -n '/^$/d;/^#/!{p;q}' $fFFile |\
                            grep -c '^\(function \)*[^ ][^ ]* ()' \
                          ) -gt 0 ] ; then
                          echo $fFFile
                        . $fFFile
                    fi
              done
          done
    fi Basically i circle through FPATH, look into every file and if the first non-comment-line begins with "function <some-name> ()" (this is the sed-grep-line) i parse it into the environment. This looks quite clumsy, unreliable and downright ugly, but with my limited knowledge of bash i was not able to find a better solution. Your suggestions are welcome.

bakunin

Ubuntu: 983-1: Sudo vulnerability

UNIX.com - Tue, 07/09/2010 - 17:00
LinuxSecurity.com: Markus Wuethrich discovered that sudo did not always verify the user when agroup was specified in the Runas_Spec. A local attacker could exploit thisto execute arbitrary code as root if sudo was configured to allow theattacker to use a program as a group when the attacker was not a part ofthat group. [More...]

More...

increase for the Page space

UNIX.com - Tue, 07/09/2010 - 16:39
Guy's

This is our page space , i want some information about page space and I want the good way to how to increase the page space and what's the recommended page space that need to be configured


Page Space Physical Volume Volume Group Size %Used Active Auto Type Chksum

hd6 hdisk0 rootvg 512MB 19 yes yes lv 0




Check when password expires

UNIX.com - Tue, 07/09/2010 - 16:31
How do I check to see when a password expires on a user account with using the CLI?

script that will automatically extract

UNIX.com - Tue, 07/09/2010 - 16:26
how do i write a script that will automatically extract rar files after the download in a particular folder?

can you give me an idea please? :D or is there an existing script for this?

HOWTO plug server into infrastructure

UNIX.com - Tue, 07/09/2010 - 16:11
Hi

I consider how to plug server into infrastructure. What is the actual standard for sys admins to plug server and make it up and running.

Whether use LACP/EtherChannel, IPMP, JumboFrame and when ?
How to make server redundancy and fail-over to maximize its uptime ?
How many network interfaces use (e.g. 2 or more) ?

thx for help.

problem with echo inserting single quotes

UNIX.com - Tue, 07/09/2010 - 15:47
Consider the following script:

Code: #!/bin/bash

exclude='Archive PST,SystemState'

IFS=$","
rsyncExclusions=$(for exclude in ${exclude}; do echo -n -e --exclude=\"${exclude}\"\  ; done)
unset IFS

echo rsync $rsyncExclusions test
rsync -avh --delete --delete-excluded "$rsyncExclusions" /tmp/test1 /tmp/test2 When the script runs it fails to exclude the exclusions from $exclude. the output from bash shows that when it echoes the exclusions into the rsync line they appear to have single quotes around them which ruins rsync's interpretation of the excludes.

The echo of the variable appears fine.

Code: $ bash -x /tmp/exclude
+ exclude='Archive PST,SystemState'
+ IFS=,
++ for exclude in '${exclude}'
++ echo -n -e '--exclude="Archive PST" '
++ for exclude in '${exclude}'
++ echo -n -e '--exclude="SystemState" '
+ rsyncExclusions='--exclude="Archive PST" --exclude="SystemState" '
+ unset IFS
+ echo rsync '--exclude="Archive' 'PST"' '--exclude="SystemState"' test
rsync --exclude="Archive PST" --exclude="SystemState" test
+ rsync -avh --delete --delete-excluded '--exclude="Archive PST" --exclude="SystemState" ' /tmp/test1 /tmp/test2
sending incremental file list
test1/
test1/Archive PST/
test1/SystemState/

sent 98 bytes  received 24 bytes  244.00 bytes/sec
total size is 0  speedup is 0.00 How can I get the output of the exclusions to appear exactly how echoing the variable looks?

using awk to print absolute value

UNIX.com - Tue, 07/09/2010 - 15:28
Hi,
I have a file contaning some variables with negative values, but i just want to print the positive value

awk -F"|" '$2<0 { print $1,$2 }' tom.unl > tee.unl

i want the $2 = absolute value
eg -200 should print 200

How can i do this.

How to write to .csv file

UNIX.com - Tue, 07/09/2010 - 14:48
Hello All,

I am writing a shell script in which I am reading from a .csv file.
I am capturing the data of the .csv file into variable. Now after doing some manipulation on those variables I want to write these variables to another .csv file.

I have achieved the part of
1) reading from .csv file
2) doing manipulations and arriving at variables such as ccypair,optiontype etc.

I would like to know how to write these variables in a .csv file (comma seperated) as a row.

Please suggest.

Thanks & Regards
Arundhati

Distribution Release: Linux Mint 201009 "Debian"

UNIX.com - Tue, 07/09/2010 - 14:15
Source...

Help on "tr' command

UNIX.com - Tue, 07/09/2010 - 14:08
Hi All,

I was asked to rewrite a script which is working in Solaris to Linux. In the existing script i have following 'tr' command.

Code: tr -d '\002\003\013\032\001\014\272'  <$INPUT_FILE | tr -cd '[:print:]\n' >$OUTPUT_FILE Some1 help me to understand this. Here is my understanding,
tr -d option deletes the occurance of '\002\003\013\032\001\014\272' in the input_file and prints with new line character.

Brief abt script, we are extracting our feed file from Aix (mainframe) and loading that in application running in the Linux OS. Since mainframe uses EBCDIC i have to remove some extra character which is not applicable or printable in ascii. So this script is used to remove those non-printable character and load into solaris server successfully. It is my time to convert this into Linux.

thx for help

Mapping with series from master file and calculate count

UNIX.com - Tue, 07/09/2010 - 14:08
Hi All,

My shell script is calculating the count of each shortcode series wise whose sample output is as follows:
Code: --------------------------
56882
9124 1
9172 1
9173 4
8923 6
9175 1
9058 2
7398 2
--------------------------
58585
series count
9124 1
8858 17
9061 21
9125 21
9126 7
9171 106
9172 4
7899 4
9173 7
9175 14
9059 92
7871 94
7396 183
7398 386
9060 13
--------------------------
58888
series count
9124 12
8858 2
9061 44
9125 36
9062 139
9171 20
9126 17
9172 94
9173 84
7899 113
8923 76
9175 59
9058 101
7870 327
7871 36
9059 24
7396 19
9122 202
7398 55
9060 62
--------------------------
57575
series count
8858 6
9124 6
9061 5
9062 26
9125 11
9171 5
9126 43
9172 14
9173 43
7899 7
9058 25
7870 15
8923 46
9175 71
7871 6
9059 13
7396 28
9122 17
7398 37
9060 15
--------------------------
57677
series count
9175 5 Code for generating above output is as follows:
Code: Ydate=`date -d'-1 days' +'%Y-%m-%d'`
shortcodes=( "56882" "58585" "58888" "57575" "57677" );
for shortcode in ${shortcodes[@]}
do
        echo "--------------------------";
        echo $shortcode;
        echo "series count";
        grep "ShortCode=tel:${shortcode}" /opt/bea/ocsg_4.1/logs/customlogs/App_OP.log.$Ydate | awk -F"|" '{ arr[substr($2,1,4)]++ } END { for( no in arr) { print no , arr[no] } }'
done And i have one master file whose data is as follows:
Code: 9059 North
7398 South
9175 North
9122 South
9175 North
7871 South Now I want to map each series count with its Region mention in the master file and calculate the count region wise like following:
Code: --------------------------
57677
 
North 5
South 0
--------------------------
57575
North 178
South 200
--------------------------
58888
North 123
South 109 Please help me in modifying my scipt for getting the above output
Thanks in advance.

How to Compare two files

UNIX.com - Tue, 07/09/2010 - 14:07
Hi,

I have two files with me.
Code: f1.txt
-rwxr-----  1 mr459s  other        7505951 May 21 09:04 a1.gz
-rw-r-----  1 mr459s  other        16419332 May 24 03:54 a2.gz
-rw-r-----  1 mr459s  other            1001 May 24 03:54 a3.gz
-rwxr-----  1 mr459s  other            298 May 25 08:49 a4.gz
-rwxr-----  1 mr459s  other        22657154 May 28 05:52 a5.gz
-rwxr-----  1 mr459s  other      129274887 May 28 05:56 a6.gz
-rwxr-----  1 mr459s  other      355929421 May 28 05:56 a7.gz
-rwxr-----  1 mr459s  other      289019287 May 28 05:56 a8.gz

f2.txt
07-25-10  05:15PM              7505951 a1.gz
07-25-10  05:14PM            16419332 a2.gz
07-25-10  05:14PM                1001 a3.gz
07-25-10  05:15PM                  298 a4.gz
07-25-10  05:14PM            22657154 a5.gz
07-25-10  05:39PM            129274887 a6.gz
07-25-10  05:38PM            355929421 a7.gz
07-25-10  05:35PM            289019287 a8.gz Basically i have to compare the size of each file listed(8 files) in f1.txt to files listed in f2.txt and put result in another file. The sequence of the files are not constant.

I tried a lot but did not get much. So could any one please suggest how to do this.

Thanking in advance.

Daily grep on a log file

UNIX.com - Tue, 07/09/2010 - 14:06
Hi,
I would like to execute a daily grep like:
grep 2010-09-06 statistics.log|grep API > /var/tmp/stat20100906_sp.txt

On date e.g. 2010-09-07 run a grep on yesterday's date, from the result grep the word "API" put all in /var/tmp
Would like to have a script configured in the crontab, running a grep on "yesterday's" date and put in in /var/tmp.

Today I execute this manually each day...:cool:

P.S. O/S = Solaris (bash)

How can I zoom to 2 fields ?

Baanboard.com - Tue, 07/09/2010 - 14:05
Forum: Tools Development Posted By: Gibbsnich Post Time: 3rd September 2010 at 18:48

check web content - Ksh

UNIX.com - Tue, 07/09/2010 - 13:28
Hi everybody!
I wonder if I could see some text content of a website, via command line...
That could be very helpful, in order to automatize a lot of projects im working on.

thx a lot

How to keep process running after apache restart.

UNIX.com - Tue, 07/09/2010 - 13:00
I have posted this on the Web subforum but it seems that nobody knows to do this, maybe someone has a solution here. Thank you

I have a PHP application that starts a couple of processes on the server...the problem is that if I restart apache those running apps will die.

How can I start them in a way that they are not killed when I restart/stop apache ?

PHP Code:       $cmdstr = "nohup ".$config['hsp_path']."/".$config['sc_trans']." ".$config['hsp_path']."/autodjs/".$port."/".$srvname.".conf";
      $cmdstr .= " > /dev/null & echo $!";
      $pid = shell_exec($cmdstr); 
This is how I start that app.
  • « first
  • ‹ previous
  • …
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • …
  • next ›
  • last »
Syndicate content

Navigation

  • Glossary
  • Recent posts

Search

User login

  • Request new password

Recent comments

  • reply this post
    2 weeks 13 hours ago
  • answer
    2 weeks 4 days ago
  • On the same port
    14 weeks 3 days ago
  • All, with 2 daemons running
    17 weeks 6 days ago
  • /etc/init.d/sshd
    22 weeks 46 min ago
  • No easy way to do this
    22 weeks 9 hours ago
  • external iface is dhcpd addressed
    22 weeks 1 day ago
  • Great
    24 weeks 2 days ago
  • Great!
    27 weeks 2 days ago
  • Thanks!
    29 weeks 10 hours ago

Use Free Software!

Visit the Free Software Directory

Baanboard.com

  • Porting set upgrade (Baan IVc4)
  • Compile Standard Scripts
  • Printing from LN to Excel printer makes column tpyes in excel as general
  • eliminate line feed at end of a text
  • good franchise lawyer
more

UNIX.com

  • file size
  • Timed Scripts
  • Add route to solaris10
  • Help about identify the SP of my OS (Aix5.3)
  • passwd on a simple script
more

  • home
  • contact
  • services
  • baanboard
  • msx