I have many log files in a directory. In those files, there are many lines. Some of these lines contain ERROR word. I am using grep ERROR abc.* to get error lines from all the abc1,abc2,abc3,etc files. Now, there are 4-5 ERROR lines that I want to avoid. So, I am using This works fine. But when I insert 1
Tag: shell
bash command fails in tomcat/java Runtime.getRuntime.exec(), but works from command line
I have a tomcat webapp that runs a process in the shell because several of the utilities are not available in java. This code works perfectly on other machines, but there is a mysterious problem on my public server. I print the string to the log, and it looks like this: (path/to/ is not the actual paths) If I copy
Background rsync and pid from a shell script
I have a shell script that does a backup. I set this script in a cron but the problem is that the backup is heavy so it is possible to execute a second rsync before the first ends up. I thought to launch rsync in a script and then get PID and write a file that script checks if the
C Corrupted double-linked list after calling chdir
I’ve been working on some C code to provide functionality similar to the shell. So far it can run most commands like cat, ls, ls | grep …, etc. After writing code to implement the functions “cd”, “pwd”, “pushd” and “popd”, I have been testing it. If I write “cd ..” or “cd anydir” it will run “chdir(anydir)” and return
How do I get screen resolution in a shell script on Linux
Environment System: Linux Mint 18 / 19 Cinnamon 64-bit. Shell: dash (POSIX). Question I need to dynamically account for the screen resolution in a POSIX shell script. I prefer a function for re-use. Answer Function Usage
Are linux shell pipes pipelined?
Given a file input.txt if I do something like is the output from the first command continuously passed (as soon as it is generated) as input to the second command? Or does the pipe wait until the first command finishes to start running the second command? Answer Yes, they’re pipelined — each component’s stdout is connected to the stdin of
Comparing two files at end of line in Linux
I would like to compare two files and get the output of matching string in one of the files at the end of the line: Let’s say I have two files:- file1: file2: I could do something like this: This gives me the following output: This is because abcdef in file2 matches both of those lines in file1. However, what
Jenkins shell string quotation replacement
I have a Jenkins job with an execute shell box. In the execute shell I use bash instead of dash (sh). In the execute shell I have strings which are supposed to be interpreted as they contain escape sequences (in this case the new line: n), so here is an example execute shell: My problem here is that the script
Use awk to create file
I have a file that contain : Mr Q 01629699998 Ms Nhung 011287633 … I would like to use this awk ‘{print “BEGIN:VCARD”;print “Name:”$0;print “TELEPHONE:”$0;print “END:VCARD”}’ file to create this result BEGIN:VCARD Name: Mr Q TELEPHONE:01629699998 END:VCARD BEGIN:VCARD Name: Ms Nhung TELEPHONE:011287633 END:VCARD … But the code above does not get that,Anyone can help me ,thanks Answer Try: How it
what does -d value in an if expression in shell?
I am trying to understand a part of search function written in a piece of code below is the expression mentioned. Answer You can use it to determine if a directory exist like