unix

How to create folders using file names and then move files into folders?

I have hundreds of text files in a folder named using this kind of naming convention: Bandname1 - song1.txt Bandname1 - song2.txt Bandname2 - song1.txt Bandname2 - song2.txt Bandname2 - song3.txt Bandname3 - song1.txt ..etc. I would like to create folders for different bands and move according text files into these folders. How could ...

rearrange column's elements and display count

Hi , i have text file like this: i am fine how are you what i how are i need an output like below: i : 2 am : 1 fine : 1 how : 2 are : 2 you : 1 what : 1 there can be many repititions of the words: how could i do this using a shell script or an awk? ...

Checking the return value of a function in a macro

I have core function which i can call from the customized module of the product. function_core is the core function which will return and integer we have a macro in header file #define func_cust function_core i am calling func_cust inside my customized code. EDIT: but inside the core we again call some other core function #defin...

How do you read a segfault kernel log message.

This can be a very simple question, I'm am attempting to debug an application which generates the following segfault error in the kern.log kernel: myapp[15514]: segfault at 794ef0 ip 080513b sp 794ef0 error 6 in myapp[8048000+24000] Here are my questions: Is there any documentation as to what are the diff error numbers on segfault, ...

Execute and output PHP on a C based web-server - Stuck!

Hi all, I'm doing a bit of coursework for university and I'm completely baffled. Basically I've made a basic web server (which uses sockets) in C. I've now got to make it so that any .php file, is run through the php compiler and output. The problem I'm having is that I've tried using system() and execlp() (the latter was recommended b...

Are passwords on modern Unix/Linux systems still limited to 8 characters?

Years ago it used to be the case that Unix passwords were limited to 8 characters, or that if you made the password longer than 8 characters the extra wouldn't make any difference. Is that still the case on most modern Unix/Linux systems? If so, around when did longer passwords become possible on most systems? Is there an easy way to ...

How can I copy a file on Unix using C?

I'm looking for the Unix equivalent of Win32's CopyFile, I don't want to reinvent the wheel by writing my own version. ...

How to Patch Live Running Unix Code

Let's say you have a function foo() compiled into a program that is running on Unix. While the program is running, can one "replace" the function foo by dynamically loading an object file containining a modified version of foo()? On an embedded system I worked on in the past, we could unprotect the text segment and then essentially "...

How to change the prompt in putty

Hi when i start putty on a server i get the promp like below: hpbl802!benjaminb:~ [22]> How can i change this prompt to benjamin:~ [22]> ...

Static function access in other files

Hi, Is there any chance that Static function can be assessed outside the file scope. ? ...

shell script running by sensing a file

Hi, i am working on unix. i want to write a shell script which will check for a file called "temp_file.txt" on windows and then execute some commands. is this possible? how could we connect to the windows and go to a specific directory and check for a file? ...

Getting a list of used libraries by a running process (unix)

I need to find out what libraries a unix process has loaded and might use throughout it's lifetime. Is this possible and how. Or better yet, i have a library name and i need to find out what processes are using it, is this possible. On the same note, is it possible to get notified some how when a unix process is launched and when it is ...

Find command in unix

I want to perform a find command in a directory, and exclude from the set of results all files that are .gif, .jpeg, and .class. I was wondering if someone could help me out. I've been trying to play with the regex option, but clearly I'm not doing it properly. ...

editing text files with perl

I'm trying to edit a text file that looks like this: TYPE=Ethernet HWADDR=00:.... IPV6INIT=no MTU=1500 IPADDR=192.168.2.247 ... (Its actually the /etc/sysconfig/network-scripts/ifcfg- file on red hat Linux) Instead of reading and rewriting the file each time I want to modify it, I figured I could use grep, sed, awk or the native text ...

One-liner for Setting Global Default Options for Unix/Linux Commands - Best Practices

I consistently run the ruby sudo gem install mygem command with these two options on my production system: sudo gem install mygem --no-ri --no-rdoc I do that to save a little on space and on how long it takes to setup the documentation. Is there a way (other than hardcoding them into the bin/gem file) to say 'always run this command w...

Use grep in Mac Terminal

I use Terminal in Mac with the following command: df -lak | grep File||disk02 what I want to use this script to get the header of df command (disk space) and the line with disk02 only. I think '|' is a char in grep as or logic. However, since I am using grep in Terminal, the char '|' also means pipe. Therefore I tried to use '||' t...

find command the list suid and gid files under root/ help

Hi, im looking for a find command to find all files under the / files that are suid and gid. i got, find / ???. How can i use the find command to look for files under the / that have suid and gid. Thanks ...

start learning Proc(embedded sql with C)

Hi, I am basically working on unix and c programming. i want to start learning Pro*c on unix. Is there any good online tutorial which will help me start writing simple programs in pro*c and compiling those Pro*c files.? Thanks in advance for your help. ...

Fork() not working to calculate last few digits of command line arguments.

I' m trying to calculate the total sum of a line of command arguments entered in from the terminal. Thus far, I've gotten to the point where it will print out everything until the very last few digits. I have to make use of fork() to do all of the computation with my companion program. The main program is unable to do any computation for...

getopt_long vs getopt_long_only

Hi guys, to do a proper Linux/unix styled application, what is the best choice (eg. afaik ls uses getopt_long but for example ffmpeg getopt_long_only). Which one do you recommend? Cheers, ...