unix

is there a way to look at the preprocessor expanded file in C

Hi i want to know how could we look at the c file after it has been expanded by the preprocessor before compilation with all the macro values put in the code inside the function where ever they are used. in there a way to do it? ...

UNIX Learner? Books? Websites?

I am looking to buy a book on UNIX for programming, shell scripts and overall about UNIX, any useful UNIX tutorial websites or books you guys recommend? ...

install java se 6 on a mac without software updater

hello guys i've come from a very long issue where i was obliged to remove the /System/Frameworks/JavaVM.framework/Versions/1.6.0 and the 1.6. now i downloaded the JavaForMacOSX10.5Update1, because it's not available anymore on the software updater, and run it.Now i can't find it in /System/Frameworks/JavaVM.framework/Versions/ where i'm ...

Cleaning hanging IPCS in UNIX

I knew that IPCRM is used to clean hanging IPCS and semaphores for a particumar user by passing the segment id or the semaphore id in either -m or -s option. WE NEED TO PASS INDIVIDUAL SEGMENT ID/ SEMAPHORE ID IN -m OPTION. Is there any way to clean ipcs that belongs to a particular user in just one move. I think shell script could be ...

sed regex to non-greedy replace?

I am aware of another question that is quite similar, but for some reason I'm still having problems. I have a GC log that I'm trying to trim out the Tenured section enclosed in []. 63.544: [GC 63.544: [DefNew: 575K->63K(576K), 0.0017902 secs]63.546: [Tenured: 1416K->1065K(1536K), 0.0492621 secs] 1922K->1065K(2112K), 0.0513331 secs] I...

Advanced grep unix

Usually grep command is used to display the line contaning the specified pattern. Is there any way to display n lines before and after the line which contains the specified pattern? Can this will be achieved using awk? ...

Quartz job tunning

hello there is something i've realized with quartz when working.Say a cron is set to wake up every 2min with the expression 0 0/2 * * * ? . When you run the project at say 13:10:30, the first action happens at 13:12:00 and the second 13:14:00 and every 2min 0 second for the rest. Obviously between the startup of the project and the firs...

What is the difference between read and pread in unix?

What is the difference between the functions read() and pread() in unix? When choosing between them, what points should I take into consideration? I googled for the difference between them but without results. ...

Development Environment in Windows

What are your recommendations for setting up a development environment in Windows, especially when not using an IDE. I am attempting to familiarize myself with Windows, and I feel a bit lost. What do developers commonly work on, especially when developing in multiple languages (e.g. Java, Python, C) in the same time. So far, I have be...

Determining execution time of a thread and IO accesses by different threads

Hello I want to determine execution time of a thread in a multi-threaded program, and I also want to know about IO accesses made by each thread. Is there any command/tool which can do this for C programs? ...

What is the difference between a .sl and a .so on HPUX?

Since you can link your application to a .sl file and a .so file what exactly are the differences between .so and .sl files? ...

How to egrep variable-Unix shell script

I’m trying to validate input by using egrep and regex.Here is the line from script (c-shell): echo $1 | egrep '^[0-9]+$' if ($status == 0) then set numvar = $1 else echo "Invalid input" exit 1 endif If I pipe echo to egrep it works, but it also prints the variable on the screen, and this is something I don't need. ...

How do I get vim's :sh command to source my bashrc?

Whenever I start a shell in vim using :sh, it doesn't source my ~/.bashrc file. How can I get it to do this automatically? ...

Problem with piping commands in C

Hi, I'm trying to create a simple shell in C for Unix. I've been able to do all the parsing of commands and execution, but I'm having a problem with piping. I think the problem is that I'm not hooking into the correct pipe for the input of the second command. For example, if I type "ls | wc", it will pause after the "wc" command, which...

Multiple threads in C program

I'm writing a Unix application in C which uses multiple threads of control. I'm having a problem with the main function terminating before the thread it has spawned have a change to finish their work. How do I prevent this from happening. I suspect I need to use the pthread_join primitive, but I'm not sure how. Thanks! ...

What's the proper way to drop to a lower privilege level with setuid?

I'm writing a program in C that binds to a port < 1024. I'd like it to run at non-root privileges thereafter. I know I need to call setuid(), but with what argument? UID's vary from system to system. ...

sed stream editor unix linux command : how to keep retain a paragraph with a particular text string

Hi I have managed to put text in a file by separating them by blank lines. I am trying to keep only those paragraphs that have a particular string. Though the Sed FAQ mentions a solution it does not work (see examples below) http://www.catonmat.net/blog/sed-one-liners-explained-part-two/ 58. Print a paragraph that contains “AAA”. (P...

Text Pattern Processing in paragraph with unix linux utilities

I have a file with the following pattern (please note this is a file generated using sed, awk, grep etc processing). The part of file input is as follows. filename1, BASE=a/b/c CONFIG=$BASE/d propertiesfile1=$CONFIG/e.properties EndOfFilefilename1 filename2, BASE=f/g/h CONFIG=$BASE/i propertiesfile1=$CONFIG/j.properties EndOfFilef...

How can you take ownership of a hid device?

What I would like to take ownership of a hid device that may already have been plugged in, consume it's output, while preventing others(X11 or terminal) from consuming it. If I can help it, I don't want to pretend to be a terminal, but rather to monopolize a particular hid or character device. The idea is that some hid devices may be re...

Need help in executing the SQL via shell script and use the result set.

Hi All, I currently have a request to build a shell script to get some data from the table using SQL(ORACLE). The query which I'm running return n number of rows.. Is there a way to use something like result set. Currently , I'm re-directing it to a file, but I'm not able to reuse the data again for the further processing.. Any hel...