12-11-2007
Have a basic 'for i in cat list' - Trying to get i to be set to a name with a space
Hi
Have a file called ldap.list:
******
"o=unix forum"
o=groups
******
i wrote a basic script that runs:
for i in `cat ldap.list`
do
ldapsearch -h host -p 389 -b $i
THE PROBLEM: - It looks like when the for i in cat ldap.list runs, it doesn't seem to care about the " ", it treats the space as a new line return, so if you just try to run a 'for i in ldap.list, grep $i' - you get
o=unix
forms
rather than - "o=unix forums"
I need to keep the " " in tact.
Thanks in advance for the help!
-littlefrog
10 More Discussions You Might Find Interesting
1. SuSE
Hey,
I was wondering if anybody could help me setup my PhpMyAdmin on my SUSE linux 9.1 machine. I want to use it to access MySQL server instead of the defualt MySQLCC-Console Manager.
I have not tried yet but i have done a such and it's installed in one of the folders.
I would like to point... (15 Replies)
Discussion started by: sybella1
15 Replies
2. UNIX for Dummies Questions & Answers
I am trying to create new files under my directory...but i getting the following message...
cat: write error: No space left on device
How do we handle this error.
I am not getting this error when I login as the super user (3 Replies)
Discussion started by: igandu
3 Replies
3. Shell Programming and Scripting
trying to exclude hostnames ending in "s" from a host file:
# cat hosts
ssef
ssefd
ssefsfff
ssefsfs
# for x in `cat hosts`; do echo "${x/*s}" ;done
ef
efd
fff
#
How can I echo/or not echo only 'ssefsfs' ??
thanks (4 Replies)
Discussion started by: prkfriryce
4 Replies
4. UNIX for Dummies Questions & Answers
Hi all,
Today I was just fooling around with directories and faced this. I create a directory 'testdir' and create a file 'myfile' inside it.
gandalf@gondor:~$ mkdir testdir
gandalf@gondor:~$ cd testdir
gandalf@gondor:~/testdir$ touch myfile
Then I set the following permissions for the... (7 Replies)
Discussion started by: ranj@chn
7 Replies
5. UNIX for Advanced & Expert Users
Hi,
We have an FTP server (vsftpd) running on Linux, that I've kinda built a "Data Management" system around. I could use some ideas as to the best way to handle/create "triggers" for file notifications.
Internal users drag 'n drop files from their Windows boxes to the server via Samba... (2 Replies)
Discussion started by: mph
2 Replies
6. Shell Programming and Scripting
EDIT : This is for perl
@data2 = grep(/$data/, @list_now);
This gives me @data2 as
Printing data2 11 testzone1 running /zones/testzone1 ***-*****-****-*****-***** native shared
But I really cant access data2 by its individual elements.
$data2 is the entire list, while $data,2,3...... (1 Reply)
Discussion started by: shriyer
1 Replies
7. Shell Programming and Scripting
While doing cat on a large file (3 GB file) , I am getting the no space error in the shell script hugefile.sh.
Eg: for i in `cat hugefile.txt`
do
echo "$i"
done
error: hugefile.sh: no space
Please let me know your thoughts in handling this no space issue. (2 Replies)
Discussion started by: techmoris
2 Replies
8. Shell Programming and Scripting
I have long list of input file's content that I plan to "cat" all of the content into another output file.
The total input file is around 20,000 which all named with ".txt"
Below is the command that I try:
cat *.txt > all_file.out
-bash: /usr/bin/sudo: Cannot allocate memory
Unfortunately,... (2 Replies)
Discussion started by: perl_beginner
2 Replies
9. Shell Programming and Scripting
I have a file say ADCD which is like following-->
Please consider 'z' as space
#cat ADCD
<!--Yzzz|z-->
<!--Nzzzzz-->
Now I want to store the content of this file to a variable say VAR like this-->
#VAR=`cat ADCD`
#echo $VAR
<!--Yz|z--> <!--Nz-->
Now I don' t want the variable... (2 Replies)
Discussion started by: muchyog
2 Replies
10. UNIX for Beginners Questions & Answers
Hi,
Hope you are all doing fine.
The problem today i faced during my coding was i wanted to add a space equals to a tab character in front of all the lines which i am cat using tee command.
Main file contents
mainfile
... (4 Replies)
Discussion started by: mad man
4 Replies
LEARN ABOUT OPENSOLARIS
ldap_init
ldap_open(3LDAP) LDAP Library Functions ldap_open(3LDAP)
NAME
ldap_open, ldap_init - initialize an LDAP session
SYNOPSIS
cc [ flag... ] file... -lldap [ library... ]
#include <lber.h>
#include <ldap.h>
LDAP *ldap_open(const char *host, int port);
LDAP *ldap_init(const char *host, int port);
DESCRIPTION
The ldap_open() function initializes an LDAP session and also opens a connection to an LDAP server before it returns to the caller. Unlike
ldap_open(), ldap_init() does not open a connection to the LDAP server until an operation, such as a search request, is performed.
The ldap_open() function is deprecated and should no longer be used. Call ldap_init() instead.
A list of LDAP hostnames or an IPv4 or IPv6 address can be specified with the ldap_open() and ldap_init() functions. The hostname can
include a port number, separated from the hostname by a colon (:). A port number included as part of the hostname takes precedence over the
port parameter. The ldap_open() and ldap_init() functions attempt connections with LDAP hosts in the order listed and return the first suc-
cessful connection.
PARAMETERS
These functions support the following parameters.
host The hostname, IPv4 or IPv6 address of the host that runs the LDAP server. A space-separated list of hostnames can also be used for
this parameter.
port TCP port number of a connection. Supply the constant LDAP_PORT to obtain the default LDAP port of 389. If a host includes a port
number, the default parameter is ignored.
RETURN VALUES
The ldap_open() and ldap_init() functions return a handle to an LDAP session that contains a pointer to an opaque structure. The structure
must be passed to subsequent calls for the session. If a session cannot be initialized, the functions return NULL and errno should be set
appropriately.
Various aspects of this opaque structure can be read or written to control the session-wide parameters. Use the ldap_get_option(3LDAP) to
access the current option values and the ldap_set_option(3LDAP) to set values for these options.
EXAMPLES
Example 1 Specifying IPv4 and IPv6 Addresses
LDAP sessions can be initialized with hostnames, IPv4 or IPv6 addresses, such as those shown in the following examples.
ldap_init("hosta:636 hostb", 389)
ldap_init("192.168.82.110:389", 389)
ldap_init("[fec0::114:a00:20ff:ab3d:83ed]", 389)
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Interface Stability |Evolving |
+-----------------------------+-----------------------------+
|MT-Level |Safe |
+-----------------------------+-----------------------------+
SEE ALSO
errno(3C), ldap(3LDAP), ldap_bind(3LDAP), ldap_get_option(3LDAP), ldap_set_option(3LDAP), attributes(5)
SunOS 5.11 15 Jan 2004 ldap_open(3LDAP)