So, I'm back with another, pretty much similar question. I've got a catalogue, with about 60k text files. Every file contains a single line of text with variable number of characters. Here are some examples, which will make my case easier to understand:
Example file 1.
Example file 2.
Example file 3.
Example file 4.
Example file 5.
And I've got two issues.
Issue 1. I'd like to know how many '<item id="2506"/>' records do I have in the catalogue, with specific filenames added. So in the example case I'd print something like:
example file 1 name
example file 1 name
example file 2
Since Example file 1 contains the string two times, example file 2 contains only a single record, and 3,4,5 doesn't. Is it possible to do?
Issue 2. I'd like to find every record of <item id="2506" that has the special_description in it's arguments, and print out the special_description value.
I'd see it like this:
Filename(example file4) and here printed out the x characters after the <item id="2506", so I'd see the special_description. Final output:
example file 4 special_description="blablabla"
example file 5 special_description="lololol"
I'm sorry if it's a little chaotic. I've tried different arguments of grep, but failed at both cases.
Cheers.
Hi,
I have a script similar to this
#!/bin/ksh
cd /orcl/bir/eod_badfiles
find ./ -type f -name "*.csv" -mtime +6 -exec rm -f {} \;
find ./ -type f -name "*.bad" -mtime +6 -exec rm -f {} \;
cd /orcl/bir
find ./ -type f -name "*.log" -mtime +6 -exec rm -f {} \;
This was working fine in one... (5 Replies)
Guys,
Here is my requirement..
Sample.cfg
file="*log.gz *txt.gz"
sample.sh
#!/bin/sh
. $HOME/Sample.cfg
find . -name "$file" -mtime +20 -exec ls -la {} \;
Its not finding the given *log.gz and txt.gz files.
Could anyone please help me? (8 Replies)
Hi Friends,
I'm facinf issue while moving large files using find command.I've a scenario like i've to move one day older files from one directory to anothe directory.I'm using the below command.
find $src_dir -name error -prune -o -type f -mtime +1 -exec mv {} $dest_dir \;
some times... (1 Reply)
Hi,
I am not root user. I am trying to find the file which has contains pattern "fvsfile" in root directory.
If i run the find cmd then i got permission denied and all the files are listed include pattern files. i cant get file name yet
find . print | xargs grep -i "fvsfile"
I want... (2 Replies)
Hi All,
I'm facing this below error when I move files using find command....Please help out......
$ find /home/aa/ab -mtime +90 -type f -exec mv -f {} /home/aa/ab/ac \;
mv: 0653-405 /home/aa/ab/ac/MP_060520111245.csv and /home/aa/ab/ac/MP_060520111245.csv are identical.
mv: 0653-405... (2 Replies)
Hi All,
I'm a bit new to Linux environment, moderately okay when it comes to Unix AIX. I'm facing an issue while trying to run a simple find command:
$ for file in `find . -name *.*`
> do
> ls $file
> done
This is throwing the following error:
Strangely, a few minutes... (4 Replies)
In LINUX(CentOS, RedHat) is there a way to have the banner statement appear before the logon instead of after the logon? In UNIX and Windows the banner appears before a person actually logs on, what I'm seeing in LINUX is that it appears after the login(ftp, telnet, SSH).
Thanks (0 Replies)
Yes , I have to find a file in unix without using any find or where commands.Any pointers for the same would be very helpful as i am beginner in shell scritping and need a solution for the same.
Thanks in advance.
Regards
Jatin Jain (10 Replies)
I'm trying to use find command to generate a list of a files w/ a specific extension (.axv), but I would also like to exclude/grep out another directory completely from the search (Archive). I have been poking around various sites/forums and man pages and haven't figured this out.
tb (2 Replies)
Hi all,
I have a shell script(ksh) which has the code as follows.
------------------
cd $mydir
for i in `find ./ -type f -mtime +$k`
do
echo $i
done
-----------------------
And in $mydir , i have some files which have space in theie names like "Case att15".
The out put of the... (6 Replies)