I am trying to print the output as below using the command: or But it does not print anything. O/P should be like, (I am using 0777 or 777 because of find . -type f -perm 0777) Answer you’ve got the right idea, but 777 is the octal representation of permissions, and with this you’re looking at the…
Tag: bash
Is there a bug in “zgrep -H”?
Just tried grep and zgrep on following test file: I also need the file-name printed, so I’ve added the -H switch and stepped on the following problem: E.g. depending on POSITION of -H switch in the command-line – the behavior is different for me and the issue always reproduces 🙁 One more test: Her…
Linux: Extract a specified number of lines from text file based on match
I have a text file with multiple datasets. I have written a code that searches for certain values (top left 4-letter code) in a text file but, now I need to be able to have the script copy out data from a set number of lines AFTER the match (“PHHI, etc”) is found. The data values are all formatted…
Running a bash install script as root – how to handle regular users’ files?
I am writing some bash scripts to install and configure some programs. Because the script needs to install packages – I run the scripts as root – which itself is no problem (i.e. I have root privileges etc). However once the packages are installed the script needs to configure normal user files an…
Bash: multiple redirection
Early in a script, I see this: And later: My understanding of this looks something like this: Create fd 3 Redirect fd 3 output to stderr (Upon app execution) redirect stdout to fd 3, then redirect stderr to stdout Isn’t that some kind of circular madness? 3>stderr>stdout>3>etc? I’m esp…
Unix /Linux – several applications using the same environment variables but different values?
I am looking for some advice on the following below: I have several applications and tools on a server that requires the environment to be set up with variables etc for them to run. Many of these applications use the same environment variables to run but with different values. Some of these applications have …
sbrk system call in unix
I studied like malloc uses the sbrk system call. But, some one says, the sbrk is deprecated one. Now a days malloc using the mmap2 system call to allocate memory. So, Is there any commands like (ls,cat, grep, sed) using the sbrk system call. For Ex: The above output shows that the ls command using the above s…
Force lshosts command to return megabytes for “maxmem” and “maxswp” parameters
When I type “lshosts” I am given: I am trying to return maxmem and maxswp as megabytes, not gigabytes when lshosts is called. I am trying to send Xilinx ISE jobs to my LSF, however the software expects integer, megabyte values for maxmem and maxswp. By doing debugging, it appears that the software…
for loop syntax with grep in bash
I want to do text processing for lines in file.txt that ends with 0, I wrote an easy form of it to ask my question clearly. I want the output to be: 1 343 4352 0 432 432 2345 0 I want $i variable to be “1 343 4352 0” and after that to be “432 432 2345 0” but
Bash Array not accepting WildCard
I have an Array that I have setup in a bash script. My goal is to ping through a particular port on a a server with many network interfaces. For example the ping -I eth3 172.26.0.1 command to force ping through eth3 When I setup a bash Array I can get code to work if I call the Elements (ports)