I have files in which the first column is an ID, and the second column is an option, like this: and I need to create a files with the IDs depending with the option. It is to say: I try with cat file.txt | grep -w “option” > file_option but the problem is that the files are mutually exclusive, a…
Tag: linux
Host testing C program with hard coded memory addresses
We will write functional/unit tests for C code. This C program will be run as embedded software. However we need to run tests on a Linux environment. The problem is that parts of the code under test looks like this: my_addresses.h: my_code.c Obviously, this will not run so well on Linux host environment. Is t…
Bash script commands not running
I have seafile (http://www.seafile.com/en/home/) running on my NAS and I set up a cron tab that runs a script every few minutes to check if the seafile server is up, and if not, it will start it The script looks like this: running /home/simon/seafile/seafile-server-latest/seafile.sh start and /home/simon/seaf…
Can-Bus Communication – MSG-Structure (WinUser.h) Linux equivalent
Hello StackOverflow Community I’ve searched for quite a while now but I don’t find a solution for my problem. I’m working on a project right now, where I have to port a Windows tool on to a Linux operating system (Ubuntu 12.04LTS to be specific). The Windows-based tool is written in C++ and …
what‘s the difference between shell-cmd ’dmesg‘ and file ’/var/log/dmesg‘
I think the ouput of the command dmesg should be the subset of the file /var/log/dmesg. But when I am debugging,the segmentation fault information can only be seen in the output of the command dmesg. What is the difference between them ? Answer The kernel message buffer is a ring buffer with limited space …
Remove only Alphabetic Character lines in a linux file by using Sed/Awk
I have a linux file. In that file, some lines are there merge as with numeric and alpha charcters. I want to remove only alpha characters lines.. Let us consider a file with the sample contents as below: remove only #Terry Kalkas Lans Road, Beaver Falls PA kind of lines. I want to see Please share your Ideas …
Logging python errors on raspberry pi
I’m having a helluva time debugging a python app I’ve written for an embedded raspberry pi project I’m working on because it’s using a TFT screen instead of a full monitor and has no monitor/keyboard, so i’m having to launch the python app via an icon on the TFT desktop (very sma…
Linux command to add a word after a specific line
we need to add the line <property name=”assumeHungTime” value=”600000″ /> after the line <bean id=”DataUnpacker” class=”com-packer” singleton=”false”> in one xml file . Please let me know the command to add it – using sed? Thanks, R…
Working with complex CSV from Linux command line
I have a complex CSV file (here is external link because even a small part of it wouldn’t look nice on SO) where a particular column may be composed of several columns separated by space. For viewing I am using this trick column -s,$’t’ -t < *.csv | less -#2 -N -S which is an upgraded ver…
Sending an arrow key with fprintf
I’m testing out pipes and have hit a little road block. I want to be able to simulate pressing the right arrow key through a file pointer opened by popen. The file pointer opens a display program on a different terminal, much like a projector. I would like to send a signal to advance the next image (the…