08-23-2011
Hi Corona688,
Thank you. Saved me loads of trouble!
~Guss
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hello,
Can we pass shell variables like $PATH etc. to a awk program part
for example,
awk ' {
fieldValue=$PATH
....
}' file (1 Reply)
Discussion started by: Vishnu
1 Replies
2. Shell Programming and Scripting
I noticed my script is not passing the value of variable alert to the rsh command. I need some assistance, please. This is a solaris environement. Thanks! :confused:
#!/bin/sh
echo -n "Alert number:"
read alert
rsh rhost_name 'egrep $alert /opt/var/log/*.logs' (2 Replies)
Discussion started by: lopus
2 Replies
3. Shell Programming and Scripting
Hi.
I need to parse file and assign some values to variables, right now i do like below
MYHOMEDIR=`awk '/Home/ {print $NF}' output.txt`
MYSHELL=`awk '/Shell/ {print $NF}' output.txt`
PRGRP=`awk '/Primary/ {print $NF}' output.txt`
SECGRP=`awk '/Second/ {print $NF}' output.txt`
In this... (10 Replies)
Discussion started by: urello
10 Replies
4. Shell Programming and Scripting
Using ksh to call a function which has awk script embedded.
It parses a long two element list file, filled with text numbers (I want column 2, beginning no sooner than line 45, that's the only known thing) . It's unknown where to start or end the data collection, dynamic variables will be used. ... (1 Reply)
Discussion started by: highnthemnts
1 Replies
5. Shell Programming and Scripting
I'm trying to use awk to write new entries to a hosts file if they don't exist. I need to do so depending on the type of system I have. Below is what I have, but it isn't working.
awk -v myip1=$IP1 myip2=$IP2 myhost1=$HOST1 myhost2=$HOST2' BEGIN { mqhost1=0; mqhost2=0; stap1=0; stap2=0; }
... (4 Replies)
Discussion started by: Boomn4x4
4 Replies
6. Shell Programming and Scripting
Hi guys,
I need to fetch data from logfile between two given dates,i got the below code from our forum.It works perfect,but i need to enter the value dynamically to awk while running.
awk '/2012 Jun/{p=1}!/2012 Jul/ && prev~/2012 Jul/ && p{p=0}{prev=$0}p' file
i tried the below code,but... (4 Replies)
Discussion started by: mohanalakshmi
4 Replies
7. UNIX for Dummies Questions & Answers
Hi All,
Iam trying to pass global shell variables and is not working
Main script is like below
CYEAR=`date +"%y"`
CFYEAR=`date +"%Y"`
CMONTH=`date +"%m"`
if
then
PMONTH=12
PYEAR=`expr $CYEAR - 1`
PFYEAR=`expr $CFYEAR - 1`
else
PMONTH=`expr... (6 Replies)
Discussion started by: baanprog
6 Replies
8. Shell Programming and Scripting
Trying to do so
echo "111:222:333" |awk -F: '{system("export TESTO=" $2)}'But it doesn't work (2 Replies)
Discussion started by: urello
2 Replies
9. Shell Programming and Scripting
Am looking to pass some Linux environment variables into AWK , can I simply use the -v option ?
awk -F: -v AHOME=$HOME '{ if
{rm AHOME/file.txt
a=2 } }'
config.txt
... (4 Replies)
Discussion started by: alldbest
4 Replies
10. Shell Programming and Scripting
Hello, new to the forums and to awk. Glad to be here. :o
I want to pass two shell (#!/bin/sh) variables through to awk and use them. They will determine where to start and stop text extraction.
The code with the variables hard-coded in awk works fine; the same code, but with the shell... (7 Replies)
Discussion started by: bedtime
7 Replies
LEARN ABOUT NETBSD
mb_read
MB(9) BSD Kernel Developer's Manual MB(9)
NAME
mb, mb_memory, mb_read, mb_write -- memory barriers
SYNOPSIS
#include <sys/lock.h>
void
mb_memory(void);
void
mb_read(void);
void
mb_write(void);
DESCRIPTION
Many types of processor can execute instructions in a different order than issued by the compiler or assembler. On a uniprocessor system,
out of order execution is transparent to the programmer, operating system and applications, as the processor must ensure that it is self con-
sistent.
On multiprocessor systems, out of order execution can present a problem where locks are not used to guarantee atomicity of access, because
loads and stores issued by any given processor can appear on the system bus (and thus appear to other processors) in an unpredictable order.
mb_memory(), mb_read(), and mb_write() can be used to control the order in which memory accesses occur, and thus the order in which those
accesses become visible to other processors. They can be used to implement ``lockless'' access to data structures where the necessary bar-
rier conditions are well understood.
Memory barriers can be computationally expensive, as they are considered ``serializing'' operations and may stall further execution until the
processor has drained internal buffers and re-synchronized.
The memory barrier primitives control only the order of memory access. They provide no guarantee that stores have been flushed to the bus,
or that loads have been made from the bus.
The memory barrier primitives are guaranteed only to prevent reordering of accesses to main memory. They do not provide any guarantee of
ordering when used with device memory (for example, loads or stores to or from a PCI device). To guarantee ordering of access to device mem-
ory, the bus_dma(9) and bus_space(9) interfaces should be used.
FUNCTIONS
mb_memory()
Issue a full memory barrier, ordering all memory accesses. Causes all loads and stores preceding the call to mb_memory() to complete
before further memory accesses can be made.
mb_read()
Issue a read memory barrier, ordering all loads from memory. Causes all loads preceding the call to mb_read() to complete before fur-
ther loads can be made. Stores may be reordered ahead of or behind a call to mb_read().
mb_write()
Issue a write memory barrier, ordering all stores to memory. Causes all stores preceding the call to mb_write() to complete before
further stores can be made. Loads may be reordered ahead of or behind a call to mb_write().
SEE ALSO
__insn_barrier(3), bus_dma(9), bus_space(9), mutex(9), rwlock(9)
HISTORY
The memory barrier primitives first appeared in NetBSD 5.0.
BSD
January 2, 2011 BSD