Search Results

Search: Posts Made By: goddevil
2,592
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 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...
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...}
...
9,594
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,594
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...
9,594
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...
17,613
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,613
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,613
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...
1,439
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 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...
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
45,612
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,612
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,638
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,612
Posted By tarun_agrawal
try this xargs -i sh -c './shscript {}' <...
try this
xargs -i sh -c './shscript {}' < parameters.txt
45,612
Posted By Corona688
There is no difference between having them in a...
There is no difference between having them in a file and having them in your file, ergo there is a typo.

Methyl identified it above for you.
45,612
Posted By methyl
Should be Site="sitename"
Should be
Site="sitename"
45,612
Posted By methyl
Host="servername" Port="13122" ...
Host="servername"
Port="13122"
site="sitename"
Javahome="/bin/java"
platform="pb"
filelist="x.guiclient.download"
boot="bot.jar"
If you hold your parameter file in correct unix Shell format...
45,612
Posted By venkatareddy
#!/bin/bash for x in `cat parameter.config`...
#!/bin/bash

for x in `cat parameter.config`
do
sh script.sh $x
done

thanks,
venkat
45,612
Posted By balajesuri
Option 1: $ cat parameters.txt env1 value1 ...
Option 1:
$ cat parameters.txt
env1 value1
env1 value2
env2 value3
env3 value4
env1 value5
env3 value6
env2 value7

while read x y
do
./shscript $x $y
done < parameters.txt

Option...
Showing results 1 to 25 of 30

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