Moving of file content to another two files after searching with specific pattern
Hello, Please help me with this!! Thanks in advance!! I have a file named file.gc with the content: Query1: I need to search for the pattern FR2261 and need to move the lines from the pattern till the next semicolon ( to a file called revoke. This revoke file already contains some date. I need to add the lines at the end of the revoke file. Before adding this line i need to add one more line which looks like the output of echo "--`date` Revoked as per $Requestor/$ticket" (where Requestor and ticket are two variables read from the user). Query: Also we need to paste the lines starting with revoke and delete (ex: lines 2&3) matched to the pattern FR2261 to a file called man_revoke. This revoke file already contains 4 lines (may also change). 1st line and last line should be as it is. Only in between lines need to be replaced with the current revoke&delete lines. Query3: After copying those lines to revoke & man_revoke files i need to delete the same lines from file.gc file. Also we should remove the line -- Mon Sep 10 08:53:09 CDT 2012. Sometimes this line may not exist. If it doesn't exist, we just neglect that part. so we need to give a condition as if the line prior to the searched pattern contains "--" (reference of the above line) we need to delete that line. Otherwise, we need to neglect it. Query4: How the above steps can be performed for multiple patterns (like FR2261 &NB2197)
Best Regards, Sreenivas
Last edited by Scott; 12-04-2012 at 06:06 AM..
Reason: Please use code tags, and less formatting.
Hi,
This question may be quite newbish.
I've stored a few files on my Unix system and am wondering how to search for their contents (i.e. I input the keyword and get a list of files with this keyword)
I'd then like to put it on my website (php).
I thought of find and grep, but am not... (19 Replies)
Hi
I was wondering why command 2 doesn't work like command 1 below.
1.
find . -exec grep "test" '{}' \; -print
2.
ls -R | grep "test"
I am trying to search "test" from all the files in the current and sub directories. What's wrong with my command 2?
Thanks in advance for your help (4 Replies)
I am new to shell scripting. Can someone help me out with this one please?
I need to write a script fot the following scenario:
I am currently in /parent directory.
I have a set of files in /parent/error_files directory
My script has to search for a file in /parent/erratic_files... (1 Reply)
Dear Experts,
I need to extract specific records from one file which has multiline records.
Input file pattern is:
============
aaaaaaaa
bbbbbbbb
asdf 1234
cccccccc
dddddddd
============
aaaaaaaa
bbbbbbbb
qwer 2345
cccccccc
dddddddd (7 Replies)
Hi All,
I am trying to find 4 latest files inside one folder having following File Name pattern and store them into 4 different variables and then use for processing in my shell script. File name is fixed length.
1) Each file starts with = ABCJmdmfbsjop letters + 7 Digit Number... (6 Replies)
Hi,
I have a file with following pattern. We are looking to filter out only specific content from this file.
sample
BLAdmins Server.*
LinuxAdmins Server.*
Policy Name: Recommended Default ACL Policy
Everyone ACLPushJob.Read
Everyone ACLTemplate.Read
Everyone ... (9 Replies)
hello
i wish to write the result of these below conditions in a file:
1. in a specific folder, i have many tar.gz files.
2. each tar.gz file contains ".dat" file in sub folders.
3. i wish to get the full path of these .dat files, if i find in it a specific word ("ERROR24").
4. all this... (6 Replies)