unix

unix commandline for inline replacement of all newlines in file with <br>\n

sed 's/$/<br>/' mytext.txt worked but output it all on the command line. I want it to just do the replacement WITHIN the specified file itself. Should I be using another tool? ...

Is there any list and comparison of different network stacks for Linux/Unix?

I noticed there is LWIP, a light weight TCP/IP stack for embedded systems. So I am wondering are there any other network stacks, which can replace the default Linux stack? And how do they perform? What's the pros and cons of them? THX! --wbsun ...

How to set the Don't Fragment (IP_DF) flag in C

I want to set the Don't Fragment flag on a IP packet. Is there a way to do so via the setsockopt() function or via the flags of the sendto() function? Can I do this with "normal" sockets or do i have to use raw sockets and build the entire IP header myself, setting it's offset-field to IP_DF (which is defined in ip.h)? ...

Grep particular fields in files & also print the filename for the line

hi, i have one file. it contains fields like this i/p files : a.txt 9842,5003,a,a,100 9942,5003,a,a,100 9852,5003,a,a,100 98456,5003,a,a,100 9742,5003,a,a,100 b.txt 7842,5003,a,a,100 7942,5003,a,a,100 7852,5003,a,a,100 98456,5003,a,a,100 7742,5003,a,a,100 c.txt 8842,5003,a,a,100 9842,5003,a,a,100 8852,5003,a,a,100 88456,5003,a,a,100...

How to automatically list directory contents after a CD command?

Hi all, I would like to create a new unix command to automatically list the contents of a directory after a CD command. So far, I've tried several things: alias cdls='cd $1 | ls -l' function cdls(){ cd $1; ls -l;} Both perform the listing but dont change the working directory. Thanks. ...

How to setup visual studio for cross platform c++ development

After some time mainly .net development, i need to work in c++ in a cross platform manner. I don't want to give up visual studio, so my hope was that it is possible to use visual studio and the windows target as a testbuild, and then every once in a while through means of a vm test the code on linux or mac. Does anyone have experience ...

Why lsof shows odd sockets?

I am opening a unix domain socket on file system. lsof give me this as the output. proxyShel 27379 root 0u unix 0xe8250200 0t0 26605515 /var/lib/dsock proxyShel 27379 root 2u unix 0xe74e4600 0t0 26606355 socket Well, "dsock" is the socket I am listening to, but what does the second entry mean? :s ...

How to compare versions of some products in unix shell?

Format of versions - X.X.X.X. Where X - number. What is the best way to compare two versions? I use following code: compareVersions() { VER_1=$1 VER_2=$2 print -R "$VER_1"| IFS=. read v1_1 v1_2 v1_3 v1_4 print -R "$VER_2"| IFS=. read v2_1 v2_2 v2_3 v2_4 RESULT="0" if [[ "${v1_1}" -lt "${v2_1}" ]] then RESULT="-1"...

How to log all commands run By system() System Call

Hi, I am trying to debug a C++ application which invokes many command line applications such as grep, etc through a the system() system call. I need to see all the commands the application is executing through the system() call. I tried to view these commands by enabling history and view the .history file. But these commands are not ex...

File decriptors and socket connections..

I am trying to understand how are file descriptors related to sockets. As per my understanding, you listen on a particular file descriptor, once a connection comes in , you accept it , which returns you another file descriptor ( 2 in all ) and you use this 2nd descriptor to send/recv data. The strange behaviour i am observing is that a...

In a unix shell, how to get yesterday's date into a variable?

Hi, I've got a shell script which does the following to store the current day's date in a variable 'dt': date "+%a %d/%m/%Y" | read dt echo ${dt} How would i go about getting yesterdays date into a variable? Basically what i'm trying to achieve is to use grep to pull all of yesterday's lines from a log file, since each line in the lo...

sendmail time option

is there any option to sendmail linux command on particular time . I want make or sending email on particular time . ...

How do I create and execute batch file in client machine using server side code?

Hi, I googled and searched for information regarding the title but most of them couldn't help much. I need your advise. Is this possible or is there any other way to do this? FYI, the server is running on Unix OS and clients are all running on Windows OS. Thanks in advance! I really appreciate your precious advise. ...

Have you seen library for flexible working with terminal(Unix like)?

Hi, everyone. Have you seen library for flexible working with terminal(Unix like)? I want to implement autocompletion, history, help params in my console application same operations you can see in the Unix terminals. C#, Mono library. Thanks. ...

Teradata FastLoad Inmod Compilation on Windows or Unix

Hi, I have an inmod for processing one file records and eliminate some unwanted rows and then feed the records to fastload utility. But I am not able to find a correct way to compile it and use it. I have GCC (GNU C Compiler) and TCC (Tiny C Compiler) on my windows macine and I got Fastload utility also installed. I tried to compile the...

How do I programmatically convert FLV video files to MP4 using a shell script in OS X?

I want to batch convert a directory containing hundreds of FLV files so that each file has a MP4 equivalent. I'm trying to automate this process by writing a shell script and running it from the Terminal. How do I go about doing that? Most of the instructions available are for Linux using ffmpeg but I think OS X doesn't have it. Thanks. ...

How to list specific type of files in recursive directories in shell?

How can we find specific type of files i.e. doc pdf files present in nested directories. command I tried: $ ls -R | grep .doc but if there is a file name like alok.doc.txt the command will display that too which is obviously not what I want. What command should I use instead? ...

Unix wildcard selectors? (Asterisks)

In Ryan Bates' Railscast about git, his .gitignore file contains the following line: tmp/**/* What is the purpose of using the double asterisks followed by an asterisk as such: **/*? Would using simply tmp/* instead of tmp/**/* not achieve the exact same result? Googling the issue, I found an unclear IBM article about it, and I was wo...

Reading File Remotely in C++

Hi, Is there way that I can read the file from remote server using fopen or any other api. Thanks Avinash ...

Syslog custom priorities

Is there a way one can use custom priorities in syslog daemon or rsyslog daemon? i.e. i am unable to locate a configuration change which achives it.. the other thing i can do is perhaps play with it's source. Cheers! ...