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
Tag: shell
Adding prefix of directory name to all rows of a column in Bash
I want to add a prefix of a folder’s name to all rows of a csv file. The aim is to combine this awk command with the find command so I can automate it and apply it to all directories and subdirectories within a folder. Trying to output the result to a new csv file _prefix.csv to be safe. What
Extracting month from day using linux terminal [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 2 years ago. Improve this question I am having a text file containing a list of date and time just like the sample below – posted_at”
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
Searching two patterns in files that appear in the same file but may not appear on the same line
From a directory, I need to find all files that contain a decimal numbers say 42.7 AND the keyword “foo” or “goo”. How could I achieve that? Suppose I have a directory with three files The search command should give file1.txt and file3.txt. What is a search command to achieve this? i searched for the solutions but all I could
How to parse lines from a file on a FTP server without downloading it [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 Exchange site, you can leave a comment to explain where the question
Bash script – delete old files
I have a script that uploaded a compressed file to an ftp, it is the code that I show below. This code works correctly, but I would like to adapt it so that once the file is uploaded, it deletes ftp files older than a week. Answer You can try this solution: Note: I have commented the Remove file line,
Deleting the first row and replacing the first column data with the given data
I have the directories name like folder1,folder2,folder3….folder10. Inside each directory there are many text files with different names.And each text files contain a text row on the top and two columns of data that looks like as below Then what i want to do is== at first i want to remove completely the first row of all text files present
Find all jvm log files with “Exception” message and list the count of uniq exceptions
I have a list of jvm log files that I need to search for Exception and then list the count of each unique exception . Following is the command I am using: This gives me output of total exception count in each file : How do I modify the command to get the unique exception count? Answer you can use
How to encrypt a files in Jenkins
I am trying to run Node.js app from jenkins which takes a backup of our API management platform. When we get a backup on jenkins server, we have below directories – Backup There are directories in secrets like abc, pqr, xyz which store some .txt files in it which has confidential data. I want to encrypt all files present in