From your text, it seems that given input like this:
You want an output file (Cartesian.xyz) to contain:
I also assume that the transformation can be applied to each line independently (i.e. you don't need the whole frame's worth of data to do the transformation. If that is true, then might I suggest something along the lines of the following script to read and transform the data. Looking at your code, it seems to me you are doing a lot of unnecessary rereading of the input file with each loop skipping what has already been processed.
Again, this was just a guess at what your goal is, and a big assumption that each atom's coords can be translated independently of the others in the frame.
As for the transformation. I stuck in a dummy function to illustrate it. I don't know if you have an external programme that needs to be called, or if it's a function in your script that computes the transformation. Regardless, the assumption that I made was that the process/function echoes the changed x,y,z values which can then be echoed by the statement in the while loop.
Hope this makes some sense, and that I'm not too far off the mark.
I want to combine 2 conditional statements by using -o in bash, but it won't work.
if ; then
echo "The number needs to be between 0 and $nr"
fi
Each time i execute the file it says:
./selectCitaat: line 10: syntax error near unexpected token `$1' (3 Replies)
Hi,
I need to escape slashes in my text, so I use this line:
search_string=`echo $var | sed 's@/@\\\/@g'`I expect that to replace a slash with a backslash followed by a slash. That works nicely, but it has a problematic side-effect. If there are two spaces in the var it replaces them with... (3 Replies)
I have the following bash script and it is not accepting the lines
"--"|"--""-")
"--""-"")
while
do
echo "Current Argument is ${1}"
case "$1" in
"--"|"--""-")
echo "Argument is ${1}"
shift # Skip ahead one to the next argument.
... (1 Reply)
Hi I need a script with an if statement that goes.
I need it to search through all files within a directory with the extension .test if it finds the string '71502FSC1206' then do
sed 's/71502FSC1206/\n&/g' > send.test
If it finds the string '715MCH' or '715JAC' then I need it to move the... (1 Reply)
Hey guys,
Currently trying to write a wee script that runs only when logged in as one of two users. The rest of the script is working fine, but no matter what user I try to run it as, it always fails! This is the puzzling part:if ]; then
echo "Run script as admin "
exit 1
else... (6 Replies)
Hi There,
I am trying to load data from a csv file into a DB during our DB migration phase. I am successfully able export all data into a .csv file but those have to rewritten in terms insert statement which will allow for further population of same data in different DB
My exiting csv record... (6 Replies)
Hi Gurus,
I have the below BASH code which does not works for upper case alphabets except Z (upper case Z).
What may be the reason. Also escape sequences like \n, \t, \b, \033(1m \033(0m (For bold letter) are not working.
case $var in
)
echo "Lower case alphabet"
;;
... (7 Replies)
I have the following code in bash, however "set red frmt" is not displayed.
echo "iarg_rd = $iarg_rd"
iarg_rd="2"
if ; then
echo "Hello World"
fi
if ; then
frmt="${gap}${!frmt_titl_yl}"
elif ; then
frmt="${gap}${!frmt_titl_bk}"
elif ; then
echo... (2 Replies)
Hi all,
i need a equivalent for the statement i run in bash, so it would also run in other shells. Specially i need it for ksh to run on AIX.
Here the statements:
exec > >(tee -a $log)
exec 2> >(tee -a $log >&2)
Thanks. (5 Replies)
Hi folks,
I have a scenario to convert the update statements into insert statements using shell script (awk, sed...) or in database using regex.
I have a bunch of update statements with all columns in a file which I need to convert into insert statements.
UPDATE TABLE_A SET COL1=1 WHERE... (0 Replies)
Discussion started by: dev123
0 Replies
LEARN ABOUT FREEBSD
gpioiic
GPIOIIC(4) BSD Kernel Interfaces Manual GPIOIIC(4)NAME
gpioiic -- GPIO I2C bit-banging device driver
SYNOPSIS
To compile this driver into the kernel, place the following lines in your kernel configuration file:
device gpio
device gpioiic
device iic
device iicbb
device iicbus
DESCRIPTION
The gpioiic driver provides an IIC bit-banging interface using two GPIO pins for the SCL and SDA on the gpiobus. gpioiic implements an open
collector kind of output, as recommended by the standard, when driving the pins on the gpiobus, i.e, they are never switched to the logical
value of '1', or they are '0' or simply open (Hi-Z/tri-state). So the pullup resistors are required so gpioiic can work.
On a device.hints(5) based system, like MIPS, these values are configurable for the gpioiic:
hint.gpioiic.%d.at The gpiobus you are attaching to. Normally just gpiobus0.
hint.gpioiic.%d.pins This is a bitmask of the pins on the gpiobus that are to be used for SCLOCK and SDATA from the GPIO IIC bit-banging
bus. To configure pin 0 and 7, use the bitmask of 0b10000001 and convert it to a hexadecimal value of 0x0081. Please
note that this mask should only ever have two bits set (any other bits - i.e., pins - will be ignored).
hint.gpioiic.%d.scl Indicates which bit in the hint.gpioiic.%d.pins should be used as the SCLOCK source. Optional, defaults to 0.
hint.gpioiic.%d.sda Indicates which bit in the hint.gpioiic.%d.pins should be used as the SDATA source. Optional, defaults to 1.
On a FDT(4) based system, like ARM, the DTS part for a gpioiic device usually looks like:
gpio: gpio {
gpio-controller;
...
gpioiic0 {
compatible = "gpioiic";
/*
* Attach to GPIO pins 21 and 22. Set them
* initially as inputs.
*/
gpios = <&gpio 21 1 0
&gpio 22 1 0>;
scl = <0>; /* GPIO pin 21 - optional */
sda = <1>; /* GPIO pin 22 - optional */
/* This is an example of a gpioiic child. */
gpioiic-child0 {
compatible = "lm75";
i2c-address = <0x4f>;
};
};
};
Where:
compatible Should always be set to "gpioiic".
gpios The gpios property indicates which GPIO pins should be used for SCLOCK and SDATA on the GPIO IIC bit-banging bus. For more
details about the gpios property, please consult /usr/src/sys/boot/fdt/dts/bindings-gpio.txt.
scl The scl option indicates which bit in the gpios should be used as the SCLOCK source. Optional, defaults to 0.
sda The sda option indicates which bit in the gpios should be used as the SDATA source. Optional, defaults to 1.
SEE ALSO fdt(4), gpio(4), gpioled(4), iic(4), iicbb(4), iicbus(4)HISTORY
The gpioiic manual page first appeared in FreeBSD 10.1.
AUTHORS
This manual page was written by Luiz Otavio O Souza.
BSD May 14, 2014 BSD