I am looking at a log file which just tells me the filename and the line number inside that file that has the Error. What I am interested is knowing the encapsulating function. For example, here are the contents of the log file and here are the contents of the file foo.file Based on the above log file, I want
Tag: linux
Where is ssize_t defined in Linux?
OS: Debian 9 (Linux 4.9) Compiler: GCC 8.2 Currently I am including <stddef.h> (where size_t is defined) and <stdint.h> (where most integral types are defined), but I still don’t have ssize_t. Where is it defined? Answer ssize_t is defined in sys/types.h. Per the POSIX documentation: NAME sy…
Why is stat::st_size 0 for devices but at the same time lseek defines the device size correctly?
I noticed that when I query the size of a device using open + lseek, everything is OK, but when I stat the device, I get zero instead of the real device size. The device is clean without any file system and the first bytes of device start with some text like “1234567890ABC”. What is wrong? The cod…
shell script to change directory to the tail result path
I’m using Tail to an error happen on the log lines like: and this gives results like: So what I do manually is to change the path using cd: Is there any script to change directory automatically? As I run another manual script to change file names for the files contained in /003217899/, those like /00321…
Creating a new file from a cpp program in Ubuntu [closed]
Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 3 years ago. Improve this question How do I create a new file from a cpp program in Ubuntu, and is it any different from window…
Looking to remove a set of characters from a .txt file
I am looking for a way to remove the content from one .txt file based on the other. For example, I have a file.txt with 2000 character that are random and not sorted. I have another file importantfile.txt with 2016 characters that have the same characters that file.txt has as well as 16 other characters rando…
Email pipe script runs as nobody instead of real user in postfix [closed]
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack …
Linux readelf shows object sizes with different numeral system (Hex and Dec)
I’m investigating some objects inside ELF file and using readelf for that purpose. This sample of readelf shows the size (bytes) of the objects on column 3, On large objects, readelf prints in Hex instead of dec, This breaks my size sorting attempts. (sorting ignores hex value) I tried translating all h…
Only accept 4 character long, decimal numbers as user input for read
I am writing a small script to easily capture weights, which are taken from user input with read -p. I want all captured weights to be 4 characters long, decimal numbers in the format XX.X. For example 30.2 kg. How can I make sure users can only input decimal numbers in that format? Thank you for your help. A…
Rails task not running unless rails runner has been executed in the command prompt since the linux server machine’s bootup
I’m trying to execute this task to update a large amount of data from a controller so that when an administrator user accesses this method it will run the said task. I’ve confirmed that there aren’t any issues with the task itself, but I’m not so sure about the way it’s being cal…