Visit Our UNIX and Linux User Community

Search Results

Search: Posts Made By: chihung
1,276
Posted By chihung
In Solaris, /usr/bin/grep does not support -q...
In Solaris, /usr/bin/grep does not support -q flag. Try to use /usr/xpg4/bin/grep, see man page for details.

You need to test the return status ($?) for the /usr/xpg4/bin/grep 'cos it does not...
5,193
Posted By chihung
Try with AWK: awk -F";" ' /^A=/ { ...
Try with AWK:


awk -F";" '
/^A=/ {
for ( i=1; i<=NF; ++i ) {
if (index($i, "hello world")>0 ) {
print $i
}
}
}' foo.txt
2,190
Posted By chihung
What you can do is to 'steal' some of the boiler...
What you can do is to 'steal' some of the boiler plate from 'find2perl'. Here is an example of recursively finding all the xml files and print out the content.


$ find2perl /somedir -name "*.xml"...
Forum: Solaris 06-03-2012
1,894
Posted By chihung
'seq' does not exist in Solaris. This url...
'seq' does not exist in Solaris.

This url may help. Chi Hung Chan: ZFS on 48 Disks without X4500 (http://chihungchan.blogspot.sg/2007/03/zfs-on-48-disks-without-x4500.html)
714
Posted By chihung
See this. Chi Hung Chan: Four Ways to Pass Shell...
See this. Chi Hung Chan: Four Ways to Pass Shell Variables in AWK (http://chihungchan.blogspot.sg/2009/03/four-ways-to-pass-shell-variables-in.html)
3,160
Posted By chihung
If you are using Linux, you can grep --color...
If you are using Linux, you can grep --color successfully /variosnew/fullexports/IMAGES/full_imp_images.log

For more colors, pls refer to Chi Hung Chan: Give Your Shell Some Colours...
2,519
Posted By chihung
You should try to use 'curl'. Try something like...
You should try to use 'curl'. Try something like this:

curl -F ufile=@/my/file/in/some/directory/file.txt http://localhost/upload_ac.php
2,441
Posted By chihung
It will be hard for anyone to help you with this...
It will be hard for anyone to help you with this long script. What I can propose to you is to run it with "bash -x yourscript" to get the shell to print out the commands while it is executing.

You...
2,525
Posted By chihung
Assuming that your 'link' tag is in two lines ...
Assuming that your 'link' tag is in two lines

awk '
/^<link rel="alternate" type="application\/rss\+xml"/ || /^<link rel="alternate" type="text\/x-opml"/ {
getline
next
}
{
...
2,238
Posted By chihung
Hi Scrutinizer, I don't think your proposed...
Hi Scrutinizer,

I don't think your proposed redirection will work "$s1.txt" will be interpreted by shell before doing the read and this will just resulted in ".txt". Here is my little test.


$...
2,238
Posted By chihung
Try this. The sub-shell to run 'cat' and 'wget |...
Try this. The sub-shell to run 'cat' and 'wget | sed' will allow all the output to redirect to $s1.txt

while read s1
do
url=http://ichart.finance.yahoo.com/table.csv?s=
...
50,354
Posted By chihung
Install perl XML::XPath module # yum install...
Install perl XML::XPath module

# yum install perl-XML-XPath.noarch
or
# perl -MCPAN -e 'install XML::XPath'


Try this:

$ cat xml.pl
#!/usr/bin/perl

use XML::XPath;
$,="\t";
$xp =...
2,152
Posted By chihung
This post - Chi Hung Chan: Four Ways to Pass...
This post - Chi Hung Chan: Four Ways to Pass Shell Variables in AWK (http://chihungchan.blogspot.com/2009/03/four-ways-to-pass-shell-variables-in.html) may be able to help u
50,354
Posted By chihung
xmllint seems to pack all output together. you...
xmllint seems to pack all output together. you may want to use 'xpath' (install Perl-XML-XPath)

$ xmllint --xpath '/RECORDS/RECORD/*[self::COUNTRY or self::POSTAL_CODE or...
50,354
Posted By chihung
To exactly retrieve the value from an XML file,...
To exactly retrieve the value from an XML file, you need to use an XML tool such as xmllint. It comes with Linux by default.

$ version=`xmllint --xpath...
7,191
Posted By chihung
Try to setup your CPAN to register the proxy and...
Try to setup your CPAN to register the proxy and user/password

# perl -MCPAN -e shell
cpan[1]> o conf init /proxy/
...
<http_proxy>
Your http_proxy? []
...
Your proxy user id? []
Your...
2,615
Posted By chihung
It is a lot easier with awk #! /bin/sh ...
It is a lot easier with awk


#! /bin/sh

awk '
NR==FNR {
split($0, a, "=")
var[a[1]]=a[2]
next
}
NR!=FNR && $0!~/^#/ && NF==4 {
if ( $3 in var &&...
813
Posted By chihung
What you can do is to use Firefox's Live HTTP...
What you can do is to use Firefox's Live HTTP Headers (https://addons.mozilla.org/en-US/firefox/addon/live-http-headers/) to capture a typical user login session. With that, you can loop through all...
1,656
Posted By chihung
I think the below may work. Not tested. ...
I think the below may work. Not tested.

!#/bin/bash
case $1 in
"doman1")
login='login1'
password='pass1'
"doman2")
login='login2'
password='pass2'
"doman3")
login='login3'
...
1,665
Posted By chihung
you can use 'file' to find out. read the man page...
you can use 'file' to find out. read the man page file(1) and magic(5) for more

$ file ace.png
ace.png: PNG image data, 725 x 111, 8-bit/color RGB, non-interlaced

$ mv ace.png ace.tla

$...
1,055
Posted By chihung
According to...
According to https://discussions.apple.com/thread/2389927?start=0&tstart=0, the tilde does not mean anything in the launchagent config.

What u can do is to do a substitution.

for f in...
1,204
Posted By chihung
vehicle1=car vehicle2=bicycle nawk -v...
vehicle1=car
vehicle2=bicycle
nawk -v v1="$vehicle1" -v v2="$vehicle2" 'match($0,v1),match($0,v2)' transportation.txt
3,136
Posted By chihung
vechicle="car" awk '/'$vehicle'/,/bicycle/'...
vechicle="car"
awk '/'$vehicle'/,/bicycle/' transportation.txt


Since you are using '/.../' , second way cannot be used.
1,220
Posted By chihung
Try this: #! /bin/sh if [ $# -ne 1 ];...
Try this:

#! /bin/sh

if [ $# -ne 1 ]; then
echo "Usage: $0 <uid>"
exit 1
fi

awk -v uid=$1 '
NF==2 && $1~/^conn=/ && $2~/^uid=/ {
split($1, a, "=")
split($2,...
2,254
Posted By chihung
Install perl XML::XPath module # yum install...
Install perl XML::XPath module

# yum install perl-XML-XPath.noarch
or
# perl -MCPAN -e 'install XML::XPath'


Try this:

#! /usr/bin/perl
use XML::XPath;
$,=" ";
...
Showing results 1 to 25 of 188

 

Featured Tech Videos

All times are GMT -4. The time now is 05:41 PM.
Unix & Linux Forums Content Copyright 1993-2020. All Rights Reserved.
Privacy Policy