In my files commands are like : File1.sh: File2.sh File3.sh I am looking for a command to remove the line where defined variable ‘log_file’ from all the files AND remove only ‘>> $log_file 2>&1’ part from all the files Output in files: File1.sh: echo -e “n Output is n” File2.sh File3.sh I tried multiple ways with sed but nothing worked,
Tag: unix
How to match and cut the string with different conditions using sed?
I want to grep the string which comes after WORK= and ignore if there comes paranthesis after that string . The text looks like this : So, desirable output should print only : So far , I could just match and cut before WORK= but could not remove WORK= itself: I am not sure how to continue . Can anyone
Can someone help me to translate this line of code for bash shell?
I have been struggling to understand this line of code, could someone helpe me ? for what I understood the od means will convert the outout for octal format, -An I think it means input base which is no address but why ? and the -N is the length if someone could help to translate this while sintax I would
Change another word on condition of a word in the same row in command line?
I got a html file which is as follows(delete some unuseful words). What I want is to edit it without going into the file (sed command for example). I had a dict which is Following the dict, the html file should be Before the replacement it is l1, l3 and l4. After it is l1, l2 and l3. I know
How to speed-up sed that uses Regex on very large single cell BAM file
I have the following simple script that tries to count the tag encoded with “CB:Z” in SAM/BAM file: Typically it needs to process 40 million lines. That codes takes around 1 hour to finish. This line sed ‘s/.*CB:Z:([ACGT]*).*/1/’ is very time consuming. How can I speed it up? The reason I used the Regex is that the “CB” tag column-wise
How can I find the number of 8 letter words that do not contain the letter “e”, using the grep command?
I want to find the number of 8 letter words that do not contain the letter “e” in a number of text files (*.txt). In the process I ran into two issues: my lack of understanding in quantifiers and how to exclude characters. I’m quite new to the Unix terminal, but this is what I have tried: I need to
“tee” allows us to redirect output from a command – is there any simple way to output the command string being run itself too?
When looking at log files many times I wonder what options/parameters did I use when running a given command that generated this log file. Is there any simple way to output the command string being run itself too into stdout to be redirected into the log file at the top of the file? Answer You can echo the command, tee
How do I correct this printing out copied files from directory in Unix Bourne Shell?
So i need to write a Unix Bourne Shell to to copy all the files from the directories named dir1 and dir2 into a new directory named dir3. The script first copies all the files from dir1 into dir3. The script then copies every file from dir2 to dir3 subject to these conditions: if the file from dir2 is not
AWK: Comparing substrings from two files and write to third file
I’m trying to compare two different files, let’s say “file1” and “file2”, in this way. If the substring of characters i.e 5 characters at position (8 to 12) matches in both files – file1 and file2, then remove that matching row from file 1. Finally, write the output to file3.(output contains the remaining rows which are not matching with file
search and rename and mv all files from directories and subdirectories
i have a lot of files 30k directories, 21k files inside direrctories and subdirerctories of txt files with the same name i want to search for all files inside a lot of subdirerctories and than rename them to other unique name to move them to other directory. This command not showing the duplicate files Answer i find this helpful https://askubuntu.com/questions/1003554/how-to-rename-all-jpg-files-in-all-subdirs-wich-contains-dash-in-linux