Skip to content

Tag: linux

awk in non-interactive is leaving some data missing

I’m running an awk command in a shell script, and it’s breaking the datafile. All of the data doesn’t load, and there’s a newline character at the end of each line. If I run this as a command, it works perfectly. I’ve just found that i can use fflush() and it seems to have solved…

Pop function for stack has unexpected behaviour [closed]

Closed. This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 6 years ago. Improve this question I was just taking lecture on behalf of my Guide and one student given this…

Get information in the Log file

I have a log file and below is sample log in that file. I changed only here column 3rd and 4th as SourceNo,Destination for reference. my requirement – I need to get separately, Source wise total count that sent to Destination begin with 44 code. i tried with grep and awk but it didn’t work. apprec…

Cronjob script isn’t working as expected

I have a script that work perfectly fine when I manually run it by myself, but does not seem to run properly from crontab. The main error is that the (external) environment variables are not being set. I added SHELL=/bin/bash above the cronjob definition but still got the same errors. The script I have copied…

Print text in between a string pattern and a new line in bash

I have a text file that looks like this: and I’m trying to print the part between 29.04.16_09.35 (included) and the first empty line. I thought sed would work and tried using this code: but it prints everything from 29.04.16_09.35 to the end of the file. I also tried by using a single n but it still pri…

Linux screen snapshot/redirect

Is it possible to take a “snapshot” of a running screen command, either stored as text or an image? Something akin to the following: Answer It’s possible to take so called “hard copy” of a screen session: Here we send hardcopy hc.n command to screen session 11534.test. The sessio…