grep, how to search for an exact pattern?

This was what I have tried grep -n 'qtrain' *.m But I got also SKSC.m:195:model.qtrain = model.qtrainExtra(:,k-1); SKSC.m:196:model.mqtrain = model.mqtrainExtra{k-1}; SKSC.m:197:model.sqtrain = model.sqtrainExtra{k-1}; How to get rid of the others? I

unable to execute the Perl script, use the command not found?

I have an xml file (client_23.xml) in which I need to add few lines at a particular section basis on what is there in other xml file (abc_lop.xml). Here is my abc_lop.xml file in which you see I have lot of ClientField lines with name, pptype and dat

Cmake generated the Eclipse project - No source

I am attempting to use CMake to generate eclipse project files. Although I am able to build successfully, I am unable to browse or edit the source in eclipse. This is an out of tree build, where my build directory is at the same level as my source di

Dd does not work properly?

I'm not too familiar with Linux so please forgive the ignorance. I'm trying to dump a file to a virtual floppy disk using the command: dd if=a.out of=image bs=1024 count=1 conv=notrunc It creates the image file with the exact same size of a.out (1kB)

Why is the sudo: bundle command not found?

Why is command "bundle" not found when using sudo: [root@desktop gitlab]# sudo -u git -H bundle exec rake gitlab:setup RAILS_ENV=production sudo: bundle: command not found [root@desktop gitlab]# but does exist when not using sudo: [root@desktop

Ubuntu - too many open files?

I have a websocket service. it's strage that have error:"too many open files", but i have set the system configure: /etc/security/limits.conf * soft nofile 65000 * hard nofile 65000 /etc/sysctl.conf net.ipv4.ip_local_port_range = 1024 65000 ulim

Where to put shell script / function? .bashrc or bin?

I am learning Linux commands and I learnt that you can write a shell script and put in a customized directory (e.g. ~/bin/ ) and export to $PATH or you can write it as a shell function and put in .bashrc file. If I may ask, what is the right situatio

Shell script for monitoring CPU load

I am looking for a script which does monitor the cpu usage per day. All the scripts that I have come across does kind of real time monitoring and send an email if it meets certain aspects like the load increasing beyond 80%. Is it possible to monitor

Save the output of the time command in a log file

I have a script hex.bat that has: #!/bin/bash HEX_ROOT=. HEX_COLOURS=./data HEX_PDB=. HEX_MACROS=. HEX_CACHE=./data time ./hex6i.x64 -kill -nogui -ncpu 1 -ngpu 1 -e dock.mac -l job.log All the output goes to job.log, except the time. I want to save i

Prevent getpeername () from returning 127.0.0.1

I have a Server (A) and a client (B), written in C, running on the same Linux machine. The server binds a port to INADDR_ANY, and the client binds another port to INADDR_ANY. When another client (C), which is running on another Linux machine, connect

Why my core file is not overwritten?

On Ubuntu 12.04, open a new text file and write: #include <stdlib.h> int main() { abort(); return 0; } Now run: g++ yourfile.cpp Then run the executable, which will core dump: ./a.out Now check the mtime of the file: -rw-r----- 1 xxxxx xxxxx 228K 20

Java, Mac OS, Windows and Linux

I have migrated from Linux (Ubuntu) to Mac OS. I have wrote an application in Java (swing). I have run it successfully the same code in windows and linux but in mac os I have some problems. Here is the code and problems in comments: public MainForm()

AVR ISP MKII, avrdude, Ubuntu 11.10

So, I have had this working on Ubuntu before. But then I upgraded to 11.10. Now, no such luck. Note: if you are still messing with getting this to work on eclipse, you might want to try this command line stuff... if it doesnt work here, its not going

Understand the linux planner

I am new to linux kernel and low level programming. I wanted to know how linux scheduler is supposed to be O(1) in time complexity. I came across the following article which is very informative but I have a problem understanding the pargraph I have r

signal queued in C

I have a simple program under Linux which sends SIGUSR1 signal to its child process in a cycle. But when I send e.g. 10 signals, sometimes happens, that the child received only 3 of them. Last sent signal is always SIGUSR2 and that is received every

Search and copy a string in the HTML code

I'm trying something new, I would normally do this in C# or VB. But for speed reason I'd like to do this on my server. Open File terms.txt Take each item one at a time from terms.txt and open a url (possibly curl or something else) and go to http://s