Search Results

Search: Posts Made By: ynir
2,068
Posted By ynir
ls -l --time-style +"%b %d %Y" total 16 ...
ls -l --time-style +"%b %d %Y"
total 16
drwxr-xr-x 2 root root 4096 Apr 15 2008 pluginconf.d
-rw-r--r-- 1 root root 386 Jan 10 2007 yum-updatesd.conf
1,331
Posted By ynir
$? is the status returned from previous command. ...
$? is the status returned from previous command.
In case of '0' (success) it does nothing.
In any other case, it echoes "error try again" and waits for user input to be read into the 'an'...
4,274
Posted By ynir
Hi, if I understood wel what you asked, here's an...
Hi, if I understood wel what you asked, here's an example:

# aaa=123
# BBB=aaa
# echo ${BBB}
aaa
# echo ${!BBB}
123
8,552
Posted By ynir
another way to do this
# cat aaa
aabbccddDDCCDDCCaabbcc 123
CCaaCCBBCCaaaaaaaCCCaa 234
CCDDCCAACCCCccccccccaa 999

# for i in `cut -f1 aaa -d ' '`; do echo -n "$i "; echo -n $i | sed 's/[^a-z]//g' | wc -c; done...
1,779
Posted By ynir
Of course it skipped the first line - you wrote...
Of course it skipped the first line - you wrote it was supposed to be:
Num Name ID Place ADDR City Country

If you want to apply the rule to all line, ignore the condition that refers to the first...
74,435
Posted By ynir
to prevent double pipe at the end: sed...
to prevent double pipe at the end:

sed 's/\([^|]\)$/\1|/' abc.txt
1,779
Posted By ynir
# cat aaa Num Name ID Place ADDR City Country ...
# cat aaa
Num Name ID Place ADDR City Country
1024|Name1|ID1|Street1|ADDR1|Boston|UK
1025|Name2|ID3|Street2|ADDR2|London|USA

# awk 'FS=OFS="|" {if (NR == 1) print $0; else print...
4
1,789
Posted By ynir
excellent
:b:
a little improve:

# sed '$s/,//' aaa
01473341234,
01473312121,
13131231233,
31233444555
4
1,789
Posted By ynir
a little complicated, but think it will do: ...
a little complicated, but think it will do:

len=`cat aaa|wc -l`; sed -n "1,$[${len}-1]p" aaa; tail -1 aaa |tr -d ','


run example:

# cat aaa
01473341234,
01473312121,
13131231233,...
3,684
Posted By ynir
You're right, but as you see the requested field...
You're right, but as you see the requested field has space within it, so you need $3. :)

# echo "[Alarm Severity]: MINOR" | awk '/\[Alarm Severity\]:/{print $2}'
Severity]:
# echo "[Alarm...
2,389
Posted By ynir
Works for me: # cat > xxx ...
Works for me:

# cat > xxx
USA45V1\tG\t341029
USAV1T1\tG\t450545
USAREJ1\tG\t572645
USAIX11\tG\t705650
#
#
# sed 's/[\\t]/\t/g' xxx
USA45V1 G 341029
USAV1T1 G...
3,824
Posted By ynir
Thanks sorry for the bump:o
Thanks
sorry for the bump:o
2,389
Posted By ynir
sed 's/[\\t]/\t/g'
sed 's/[\\t]/\t/g'
3,824
Posted By ynir
anyone knows something about the $LN ?
anyone knows something about the $LN ?
2,678
Posted By ynir
Hi oops, didn't notice that. See danmero's...
Hi
oops, didn't notice that.
See danmero's answer - put the line number at the end followed by '|'.
2,678
Posted By ynir
not clear
how to append the numbers?
what is the expected result?
3,824
Posted By ynir
Hi "awk", Thanks and sorry for not clarifying...
Hi "awk", Thanks and sorry for not clarifying enough.

The line is part of a running and working bash script on Linux.
PID is a local variable and the awk line is using its value to print the...
2,129
Posted By ynir
grep -E '^\"[[:digit:]]{10}\"$' example: ...
grep -E '^\"[[:digit:]]{10}\"$'


example:

# cat aaa | grep -E '^\"[[:digit:]]{10}\"$'
"1111111111"
"2222222222"
"4444232344"
# cat >bbb
"1111111111"
"2222222222"
"4444232d33"...
3,824
Posted By ynir
awk question
For the following code:

ps auwx | awk -v "PID=${PID}" '$2 == PID {print $LN}'


Two points to clarify:
1. Is the -v flag for declaring we're going to work with a variable?
2. Does the $LN...
3,684
Posted By ynir
$3 not $2
awk '/\[Alarm Severity\]:/ {print $3}' file

to put value in a different file, just redirect:

awk '/\[Alarm Severity\]:/ {print $3}' file > newfile
1,754
Posted By ynir
reg exp question
Hi,

Should be a difference between '[[:space:]][[:space:]]*' and '[[:space:]]+' ?

I use them in bash with sed and grep.

Thanks
5,431
Posted By ynir
Won't write the whole script for you. Re the...
Won't write the whole script for you.
Re the comment out, you can use:

sed 's/\(.*upsrk@gmail.com.*\)/#\1/' filename

To check if file exist you can use if [ -f "${FILENAME}" ] .
10,703
Posted By ynir
or in more details:
#!/bin/bash
...
PROG=$(which --skip-alias --skip-functions $0 2>/dev/null)
if [ "$PROG" = "" ]; then
DIR=$(dirname $0)
else
DIR=$(dirname ${PROG})
fi
export...
2,060
Posted By ynir
found myself something nice
local RET_ARR=("Object is not mapped" "Operation Internal Error" "Operation Invalid Arguments" "Object is mapped" "Path not found")
...
echo "bla bla.. ret is [${RET}] - ${RET_ARR[${RET}]}"
2,060
Posted By ynir
yes, that's the obvious way.. I preferred mine. ...
yes, that's the obvious way.. I preferred mine.
But still wonder if there's some better way
Showing results 1 to 25 of 35

 
All times are GMT -4. The time now is 12:38 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy