unix

ClearCase - find all the files that aren't updated

I'm working with ClearCase on Unix. I am working on a branch, and I want a command that will list all the files which I view on my branch, that have updated versions of them in the Main branch. Is that possible? ...

Delete strings from an html file containing a pattern using unix commands

Hi, I have a messy html that looks like this: <div id=":0.page.0" class="page-element" style="width: 1620px;"> <div> <img src="viewer_files/viewer_004.png" class="page-image" style="width: 800px; height: 1131px; display: none;"> <img src="viewer_files/viewer_005.png" class="page-image" style="width: 1600px;"> </div> </div>// this ...

Automated testing of privileged operations

How do you unit/integration test code that requires a different privilege level than exists in your continuous integration environment? In my non-root, CCRB-driven build environment, I've got some utility functions that assume privileges that don't hold in my automated build environment: either root privileges or special accounts and g...

how to insert excel data in a database with java

hi, i want to insert data from an excel file into a local database in a UNIX server with java without any manipulation of data. 1- someone told me that i've to convert the excel file extension into .csv to conform with unix. i created a CSV file for each sheet (i've 12) with a macro. the problem is it changed the date format from DD-...

find results piped to zcat and then to head

I'm trying to search for a certain string in a lot of gziped csv files, the string is located at the first row and my thought was to get the first row of each file by combining find, zcat and head. But I can't get them to work together. $find . -name "*.gz" -print | xargs zcat -f | head -1 20051114083300,1070074.00,0.00000000 xargs: zca...

Nagios timeout configuration

Hi, How do I set an individual timeout setting per service check. All timeouts default to 60 seconds as per the main configuration but I require that one particular check have a longer timeout due to the execution time. How can this be done? Please help. Thanks ...

Using popen to write in a pipe only send data when pipe is closed

I'm using popen to open a write pipe and send commands to an application. The problem is that the commands are only sent to the application when I close the pipe. FILE * fp = open(target_app, "w"); fwrite(command, 1, command.size(), fp); getchar(); //wait for a key, because I don't want to terminate the application pclose(fp); // at thi...

How to tell which unix shell I am using?

Is there an easy way by which I can tell which type of unix shell I am in i.e. whether I am in a bash / csh / ksh / tcsh ? ...

Sending commands over ssh with parameters

Hi I am trying to send a command over ssh with a parameter but the shell fails to expand the command properly any ideas what am i doing wrong with this for i in 71 72 73 74 75 do for server in server1 server2 do somestr="Some String" echo "$server hdiskpower$i \c" ; ssh $server "lsattr -El hdiskpower$i |grep $so...

Techniques for infinitely long pipes

There are two really simple ways to let one program send a stream of data to another: Unix pipe, or TCP socket, or something like that. This requires constant attention by consumer program, or producer program will block. Even increasing buffers their typically tiny defaults, it's still a huge problem. Plain files - producer program ap...

How to add a directory tree to a ClearCase repository?

I have a directory tree with sub-directories, and I want to add it to a ClearCase repository. Currently I need to rename the directory, use CC's mkdir, and so forth for every dir. Is there a way to do this automatically (maybe a ClearCase command I don't know about, or a script)? ...

##*/ use in UNIX Shell Scripting

Hi, Could anyone eloborate how ##*/ works in UNIX Shell scripting. I have seen it's use in Korn Shell. It is specifically used for removing extension of file. e.g. func_write_app_log "o Deleting status file ${CIE_STATUS_FILE##*/}" Here suppose the file is CIE_STATUS_FILE.DAT, then ##*/ will display CIE_STATUS_FILE ...

How to Decode ASN.1 format to CSV format using Unix Programing

Hi I have ASN format files i have to convert into CSV format also readable one I need a Decoder with some advanced options like schedule,Auto FTP like that ...

unistd.h and c99 on Linux

This simple .c file: #include <unistd.h> void test() { char string[40]; gethostname(string,40); } ... when compiled normally, works fine: $ cc -Wall -c -o tmp.o tmp.c $ ... but when compiled in C99 mode, gives a warning: $ cc -Wall -std=c99 -c -o tmp.o tmp.c tmp.c: In function `test': tmp.c:5: warning: implicit declaratio...

Dropping root privileges

I have a daemon which gets started as root (so it can bind to low ports). After initialisation I'd very much like to have it drop root privileges for safety reasons. Can anyone point me at a known correct piece of code in C which will do this? I've read the man pages, I've looked at various implementations of this in different applicat...

Periodic Script- Daemon-

Hi i have hp-ux and i need delete a specific file every day. then I need to do a shell script or something else with a simple command for example # rm <filename> But i need add this script to init, or convert this script in daemon TO GRANT that every day at 20:00, this script run and delete the file. I guess that the above is the pro...

ld can't find lib to link

The following is an example to describe my problem: ld -Lpath1 -Lpath2 -lA -lB -Xlinker -T -Xlinker \ -W1,-rpath,/usr/local/lib -l-o target ld: cannot find -lA collect2: ld returned 2 exit status Both path1 and path2 are relative paths, and I can find the library A according to the ld's pwd, so why did the ld output this error msg...

How do I process captured output from `tail` without reprocessing?

Hi, I want to excecute a tail command in Unix for indefinite time and capture its output in a Perl script, process it and store certain data into a database. But it should be live, meaning old data – once stored in the database – shouldn't be reprocessed. It should only capture, and process only the most recent output. Can someone pleas...

Hacking and different environments

For a long time, I've wanted to become a security expert. In fact, I've always wanted to know everything there is to know about computers in general. So I did some reading on viruses and the different type of environments you can get. What I found is that viruses affect Windows computers more than UNIX due to less people using UNIX for w...

Monitoring Oracle DB remotely

I would like to know how to do this: Environment: UNIX I would like to write a script which can be scheduled to run on a remote machine. It would read the DB details (which is residing on another machine) from a config file which looks like this: user= pass= product1_SID= product2_SID= ... Each product has its own database files. So...