Search Results

Search: Posts Made By: goddevil
87,962
Posted By Leion
To add the body, you can try this: (printf...
To add the body, you can try this:

(printf "%s\n%s\n" "$body" "$body1"; uuencode $exp_file $exp_file) |mailx -s "$email_subject" $EmailRecipients
2,595
Posted By Scrutinizer
Hi, try: awk -F, '$1=="" || $3=="" || $8==""...
Hi, try:
awk -F, '$1=="" || $3=="" || $8=="" {print>f; next}1' f=test_exc file.out > filenew.out
3,919
Posted By Chubler_XL
Again you probably want to trim $26 before doing...
Again you probably want to trim $26 before doing a compare so:

nawk -F, '
FNR==NR{C[$2]=$1;next}
{sub(/ *$/,"",$26);if($26==C[$2])$26=C[$26]}1' OFS=, reffile mainfile.csv
3,919
Posted By Chubler_XL
Try this: awk -F,...
Try this:

awk -F, 'FNR==NR{C[$2]=$1;next}{$26=C[$26]}1' OFS=, reffile mainfile.csv
3,049
Posted By ripat
Yes. Just change your FS as FS="[ |:|@||\t+]"; ...
Yes. Just change your FS as FS="[ |:|@||\t+]";



Usually you can avoid piping a grep result into aw by just using the awk condition filtering like in /string to capture/{... awk processing...}
...
3,049
Posted By Corona688
First I should note that setting FS to a regex...
First I should note that setting FS to a regex like this is a GNU awk feature. Most other versions of awk can't do that.

For a really complicated line like this, you can change FS on the fly and...
7,333
Posted By Yogesh Sawant
there used to be a command called banner. check...
there used to be a command called banner. check if you have it on your system.

banner (Unix) - Wikipedia, the free encyclopedia (http://en.wikipedia.org/wiki/Banner_(Unix))
23,718
Posted By lione.heart
#!/bin/ksh str="5.2.314" Var1=`echo...
#!/bin/ksh

str="5.2.314"

Var1=`echo $str | awk -F\. '{print $1}'`
Var2=`echo $str | awk -F\. '{print $2}'`
Var3=`echo $str | awk -F\. '{print $3}'`

echo "$Var1 $Var2 $Var3"



enjoy :)
9,595
Posted By alister
You're mistaken. You can indeed just test the...
You're mistaken. You can indeed just test the result of a command subsitution or any shell expansion by itself. [[ -n "..." ]] and [[ "..." ]] are synonymous.

Regards,
Alister
9,595
Posted By mobitron
2 things are wrong - 1. You are missing a...
2 things are wrong -
1. You are missing a double quote in your expression (echo $VAR1")
2. Your test expression can't just be the output of the grep command - you need to perform some kind of test...
9,595
Posted By balajesuri
VAR1="hostname63uf.group" if [[ "$var1" =~...
VAR1="hostname63uf.group"
if [[ "$var1" =~ /63u/ ]]
then
SUB1="yes"
SUB2="23421"
else
SUB1="no"
fi

if [ "$SUB1" == "no" ]
then
SUB2="48421"
else...
17,615
Posted By Corona688
"Do Maintenance") Why are you still...
"Do Maintenance")

Why are you still selecting based on $X though? Use $REPLY, which will be the number typed in, so you can have cases 1) ;; 2) ;; instead of cramming entire titles into them,...
17,615
Posted By Corona688
I used IFS="|" so you could have long option...
I used IFS="|" so you could have long option names with spaces in there.

You'll probably want to check REPLY instead of X for the value select reads, though! That'll be the number the user...
17,615
Posted By Corona688
Here's an example using select and the argument...
Here's an example using select and the argument array to easily switch between many menus. The same code prints all the menus and reads all the replies using the select builtin.

We use the the $1...
163,001
Posted By BOFH
Probably this'd work best: $ mv `ls -tr |...
Probably this'd work best:

$ mv `ls -tr | tail -1` /tmp/newfile

Carl
1,441
Posted By itkamaraj
1) create a file with "0" in /tmp/size.txt ...
1) create a file with "0" in /tmp/size.txt

for fs in `df -k| grep -v "^Filesystem|devices|ctfs|proc|mnttab|swap|objfs|sharefs|fd|odm" | awk '{print $1}'`; do
x="`df -kl | grep $fs | awk '{ print...
21,729
Posted By Scrutinizer
Or alternatively, use plain shell without pipes,...
Or alternatively, use plain shell without pipes, e.g.
START=2; STOP=7
linenr=0
while IFS=: read x y z ; do
linenr=$((linenr+1));
[ $linenr -ge $START ] || continue
[ $linenr -le $STOP ]...
21,729
Posted By agama
I cut/pasted the code in your post and it seems...
I cut/pasted the code in your post and it seems fine to me; I'm not getting an error. Can you past in your whole script, there is likely a typo somewhere in it.

An explanation:

The STOP and...
21,729
Posted By zaxxon
If I got it right, you can break it down altering...
If I got it right, you can break it down altering IFS:

OLDIFS=$IFS
IFS=":"

while read A B C; do
do someting here with $A or $B or $C
done < infile

IFS=$OLDIFS
21,729
Posted By agama
In your original example the variable i was...
In your original example the variable i was assigned the whole record (e.g. val1:env1:opt1). In the code that zaxxon suggested, the components val1 env1 opt1 were broken out and assigned to...
45,619
Posted By Corona688
If you run this script from a terminal, you...
If you run this script from a terminal, you should be able to read < /dev/tty to use the terminal directly without bothering stdin. /dev/tty is a special device which opens whatever device is your...
45,619
Posted By methyl
It's not the "if" condition, its the "read -p"...
It's not the "if" condition, its the "read -p" (which was not mentioned in your previous post). It's in backticks so it still functions within the "echo" line.
There is only one STDIN channel and...
13,642
Posted By Corona688
Given that awk script doesn't even have 7 lines,...
Given that awk script doesn't even have 7 lines, I'm not sure what to tell you about the syntax error, but if you want a standard deviation for each column, you're going to need to loop over each...
45,619
Posted By tarun_agrawal
try this xargs -i sh -c './shscript {}' <...
try this
xargs -i sh -c './shscript {}' < parameters.txt
45,619
Posted By methyl
Should be Site="sitename"
Should be
Site="sitename"
Showing results 1 to 25 of 30

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