unix

How can I check the internal attributes of shared objects?

When using HP-UX I can use the chatr utility to report on various internal attributes of a shared library. It will also allow me to modify the internal attributes of shared libraries that I have built. The chatr utility can report, and in some cases modify, such things as: the run-time binding behaviour, the embedded library path list...

performance tool

Hi, I basically have a unix process running and it is doing some heavy processing as well as outputting data over the network. I was wondering what system calls are used to interact with the networking layer. I would like to measure the performance metrics of this process: CPU usage, networking usage. I am not sure if this process is b...

Picking pages from PDF document

How can you pick pages from a PDF file? Pseudo-code synopsis pick-pages 1,2-69,70-73,100 example.pdf > put_to_new_file.pdf ...

Shell/Bash Command to get nth line of STDOUT

Is there any bash command that will let you get the nth line of STDOUT? That is to say, something that would take this $ ls -l -rw-r--r--@ 1 root wheel my.txt -rw-r--r--@ 1 root wheel files.txt -rw-r--r--@ 1 root wheel here.txt and do something like $ ls -l | magic-command 2 -rw-r--r--@ 1 root wheel files.txt I realize this wo...

understanding shell redirection on non existant files

ls > ls.out this will include ls.out in the list too. My understanding is: > (shell output redirection operator is creating a file first (to take the STDOUT) if it is not already existing and then ls command is coming to play and it is including the just created ls.out file in the output. Is this correct? If not, can you please elab...

On-demand paging to allow analysis of large amounts of data

I am working on an analysis tool that reads output from a process and continuously converts this to an internal format. After the "logging phase" is complete, analysis is done on the data. The data is all held in memory. However, due to the fact that all logged information is held in memory, there is a limit on the duration of the loggi...

How can I access RDF-XML from Perl (or other scripting language)?

I'm backing up my Flickr pics locally using a Perl script and the Net::Flickr::Backup module. This pulls down the original picture, a thumbnail, and the associated metadata (title, tags etc) in a RDF-XML file. I'd like to extract a subset of this metadata so I can generate a "poor man's Flickr" HTML page. This should display the thumbna...

How do I fork a new process and get back its PID in Perl?

My issue is related to using fork() within Perl code. I wish to fork a new process and capture its PID and return it back to the callee program. Is there some command in Perl which would make this possible? ...

removing duplicate lines from file /grep

I want to remove all lines where all the second column 05408736032 are same 0009300|05408736032|89|01|001|0|0|0|1|NNNNNNYNNNNNNNNN|asdf| 0009367|05408736032|89|01|001|0|0|0|1|NNNNNNYNNNNNNNNN|adff| these lines are not consecutive. Its fine to remove all the lines . I dont have to keep one of them around. Sorry my unix fu is really w...

Commenting out a set of lines in a shell script

I was wondering if there is a way to comment out a set of lines in a shell script. How could I do that? We can use /* */ in other programming languages. This is most useful when I am converting/using/modifying another script and I want to keep the original lines instead of deleting. It seems a cumbersome job to find and prefix # for al...

How can I delete duplicate lines in a file in Unix?

Is there way to delete duplicate lines in a file in Unix? I can to it with sort -u and uniq commands. but I want to use sed or awk. Is that possible? ...

shell script "for" loop syntax

I have gotten the following to work: for i in {2..10} do echo "output: $i" done It produces a bunch of lines of output: 2, output: 3, so on. However, trying to run the following: max=10 for i in {2..$max} do echo "$i" done produces the following: output: {2..10} How can I get the compiler to realize it should treat $ma...

how do you parse comma-separated-values (csv) with awk?

I am trying to write an awk script to convert a CSV formatted spreadsheet into XML for Bugzilla bugs. The format of the input CSV is as follows (created from an XLS spreadsheet and saved as CSV): tag_1,tag_2,...,tag_N value1_1,value1_2,...,value1_N value2_1,value2_2,...,value2_N valueM_1,valueM_2,...,valueM_N The header column represe...

Is there a line length limit for text files created from Perl?

While writing a Perl script, I got a requirement to write the user names with comma separation in only one line of the file. That's why I would like to know is there any restriction on the maximum size of the line in the .txt file. ...

How to pass the file name dynamically to awk when awk is used in command substitution to build the shell array?

Here is the script I am using and this is working fine: # This is a test file which we are creating and this will be used to create the shell array cat > test.txt <<End-of-message 1A|1B|1C|1D 2A|2B|2C|2D 3A|3B|3C|3D 4A|4B|4C|4D End-of-message set -A col1_arr `awk 'BEGIN { FS = "|" }{print $1}' test.txt` i=0 while [ $i -lt ${#col1_arr[...

Linux vs Windows Programming?

I've spent the last 5 years developing software with Windows as the target OS (mainly C++ and C#). Recently I started to become interested in development for other environments as well, Linux for example. So I guess I actually have two questions. The first is: Do you find developing software for Linux harder than developing for Windows?...

ldconfig for Mac OS X

Is there a parallel command to Linux's LDCONFIG for Mac OS X's Terminal? ...

Good book on Programming C in Unix environment?

I have this fantasy of becoming a really good C programmer, but I've found it very hard to find learning resources on tackling big C projects. I've learned C a few times (I forget the fundamentals, since I don't code big projects in C) from K&R, O'Reilly's Practical C, and A Book on C. However, none of these cover the existing Unix libra...

check unix username and password in a shellscript

Hi, I want to check in a shell script if a local unix-user's passed username and password are correct. What is the easiest way to do this? Only thing that I found while googling was using 'expect' and 'su' and then checking somehow if the 'su' was successful or not. ...

How can I make the list of letters from A to Z and iterate through them in the shell?

Say I want to iterate from letter A to letter Z in csh shell. How do I succinctly do that? In bash I would do something like for i in 'A B C ...Z'; do echo $i; done The point is I don't want to write A through Z, I want something like [A-Z] Can you suggest a one line suggestion in AWK or Perl? ...