You already know what [ ] do if you've used if-statements before. It's actually an independent thing, if just makes use of it. It returns success when the statement within is true, or error when false.
&& is a short-form if-then. If the thing on the left returns success, run the thing on the right. || is the opposite -- if the thing on the left returns error, run the thing on the right.
hello
A small shell scripting help..
I have a file say with 5 lines of text (text file).
At the end of everyline I need to add a comma at the end of the file.
Thanks, ST2000 (4 Replies)
Hi,
Does anyone know if its possible to add something like an end of line like c or java in unix?
dirs=/home/nosnam
var=''
for dir in $dirs
do
listDirs=`ls -d1 $dir/*`
for eachList in $listDirs
do
listRepos=`du -ks $eachList | awk '{ x+=$1 }; END { print x... (4 Replies)
Hi guys i am new to shell scripting. I wrote this script that simply searches a column value of file1 from file2.
please look at the code below:
awk '
FILENAME==ARGV { file_1_data=$0; next }
FILENAME==ARGV { file_2_data=substr($3,1,12); next }
END { ... (5 Replies)
How do I access one of the indices in array tst with the code below?
tst=sprintf("%5.2f",Car / 12)
When I scan thru the array with
for ( i in tst ) { print i,tst }
I get the output of:
vec-7 144
But when I try this in the END
print tst
It looks like it's not set.
What am... (6 Replies)
Hi,
I want to add \n as a EOF at the end of file if it does't exist in a single command. How to do this?
when I use command
echo "1\n" > a.txt
and
od -c a.txt
0000000 1 \n \n
0000003
How does it differentiate \n and eof in this case?
Regards,
Venkat (1 Reply)
Hi Folks,
Using the Vi, how can I add a numbers at the end of the line.
For eg: I have the numbers in the file as:
58.125.33
22.58.68
25.144.225
114.25.38
I need to add .0/8 at the end of all the line. So, it should be like
58.125.33.0/8
22.58.68.0/8
25.144.225.0/8
114.25.38.0/8 (6 Replies)
hi,
i have file which is having large sql query
eg :
i am executing this sql file but now i want to add ; after query on same line
i.e. i should look like
any idea how to achieve it ? (6 Replies)
How to add a comma at the end of each line in this file?30 1412
30 3352
30 5254
30 5543
30 7478
3 28
3 30
3 39
3 54
3 108
3 152
3 178
3 182
3 214
3 271
3 286
3 300
3 348
3 349
3 371 (3 Replies)
i want to add a white-space at the end of each line for my inp.file, but when i do it, the result is a new line with a white-space between each line!
my input:
2012 0811 1223 15.2 L 38.393 46.806 9.0 Teh 78 0.5 6.5LTeh 1
GAP=74 ... (5 Replies)
Seems simple but ive been searching for a good hour of so
I have a text file and would like to add a string to the end of line 5 ( as an example)
to ake tings hard the line number we have to add the text to is stored in a variable cunningly name $Line_to_append
any ideas on how this could... (2 Replies)
Discussion started by: dunryc
2 Replies
LEARN ABOUT OSX
xpc_array_set_bool
xpc_array_create(3) BSD Library Functions Manual xpc_array_create(3)NAME
xpc_array_create -- creation and management of XPC arrays
SYNOPSIS
#include <xpc/xpc.h>
xpc_object_t
xpc_array_create(const xpc_object_t *objects, size_t count);
void
xpc_array_set_value(xpc_object_t array, size_t index, xpc_object_t value);
void
xpc_array_append_value(xpc_object_t array, xpc_object_t value);
xpc_object_t
xpc_array_get_value(xpc_object_t array, size_t index);
size_t
xpc_array_get_count(xpc_object_t array);
bool
xpc_array_apply(xpc_object_t array, xpc_array_applier_t applier);
void
xpc_array_set_bool(xpc_object_t array, size_t index, bool value);
void
xpc_array_set_int64(xpc_object_t array, size_t index, int64_t value);
void
xpc_array_set_uint64(xpc_object_t array, size_t index, uint64_t value);
void
xpc_array_set_double(xpc_object_t array, size_t index, double value);
void
xpc_array_set_date(xpc_object_t array, size_t index, int64_t value);
void
xpc_array_set_data(xpc_object_t array, size_t index, const void *bytes, size_t length);
void
xpc_array_set_string(xpc_object_t array, size_t index, const char *value);
void
xpc_array_set_uuid(xpc_object_t array, size_t index, const uuid_t value);
void
xpc_array_set_fd(xpc_object_t array, size_t index, int value);
void
xpc_array_set_connection(xpc_object_t array, size_t index, xpc_connection_t value);
bool
xpc_array_get_bool(xpc_object_t array, size_t index);
int64_t
xpc_array_get_int64(xpc_object_t array, size_t index);
uint64_t
xpc_array_get_uint64(xpc_object_t array, size_t index);
double
xpc_array_get_double(xpc_object_t array, size_t index);
int64_t
xpc_array_get_date(xpc_object_t array, size_t index);
const void *
xpc_array_get_data(xpc_object_t array, size_t index, size_t *length);
const uint8_t *
xpc_array_get_uuid(xpc_object_t array, size_t index);
const char *
xpc_array_get_string(xpc_object_t array, size_t index);
int
xpc_array_get_fd(xpc_object_t array, size_t index);
xpc_connection_t
xpc_array_get_connection(xpc_object_t array, size_t index);
ARRAYS
XPC arrays are collections of XPC objects ordered by index. The index is zero-based. XPC arrays are contiguous, and values must exist at all
indexes between zero and the greatest index of the array. A hole in the array can be simulated by using a null object as returned by
xpc_null_create(3).
CREATION
The xpc_array_create() function returns a newly created array. The caller may optionally provide objects, a C array of XPC object references,
to initialize the array. The count is used to specify the size of the C array. If objects is NULL, then count must be zero. If count speci-
fies more elements than are actually present in values or if values is NULL and count is non-zero, the behavior is undefined.
GETTING AND SETTING VALUES
The xpc_array_append_value() function may be used to append a value to the end of an array. This operation increases the count of the values
in the array by one.
The value of a specific index in the array may be set using the xpc_array_set_value() function. The value must be non-NULL, and the index
must already exist (i.e. less than the count provided at creation or extended through previous append operations).
The value at a specific index of an array may be retrieved using the xpc_array_get_value() function. The result of getting a non-existing
index (i.e. one that was not specified at creation or through a previous append operation) in undefined.
PRIMITIVE GET AND SET FUNCTIONS
Various functions exist for retrieving primitive C and operating system types directly from an array without the need for an intermediate
boxed object. See xpc_object(3) for more information.
The special XPC_ARRAY_APPEND constant may be used to append a value to the end of the array instead of operating on a specific index.
SEE ALSO xpc_object(3), xpc_objects(3), xpc_dictionary_create(3)Darwin 1 July, 2011 Darwin