- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Date search/replace in bulk files
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-04-2006 08:40 PM
08-04-2006 08:40 PM
Date search/replace in bulk files
I have 1000 .rtf file, is there any way to search & replace the date in all the files.
I want to chane 10/07/2006 to 31/07/2006.
Thanks in adv
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-04-2006 08:59 PM
08-04-2006 08:59 PM
Re: Date search/replace in bulk files
cat $F|sed 's?10/07/2006?31/07/2006?g > /tmp/tempfile
mv /tmp/tempfile $F
done
HTH
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-05-2006 07:58 PM
08-05-2006 07:58 PM
Re: Date search/replace in bulk files
I would add some error checking to Victor's response and drop the 'cat':
find . -name "*.rtf"| while read F; do
sed 's?10/07/2006?31/07/2006?g $F > /tmp/tempfile
ret=$?
if [ $ret -eq 0 ]
then
mv /tmp/tempfile $F
ret=$?
fi
if [ $ret -ne 0 ]
then print -u2 ERROR: modification of $F failed
fi
done
mfG Peter
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-06-2006 08:11 PM
08-06-2006 08:11 PM
Re: Date search/replace in bulk files
perl -pe 's@10/07/2006@31/07/2006@' -i *.rtf
HTH,
Art
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-06-2006 08:15 PM
08-06-2006 08:15 PM
Re: Date search/replace in bulk files
if you want to save the input files as well:
perl -i.old '-pe s@10/07/2006@31/07/2006@' *.rtf
HTH,
Art
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2006 08:21 PM
08-21-2006 08:21 PM
Re: Date search/replace in bulk files
please, find a bit of time to assign points people reply you, trying to help.
It's very poor time consuming but very appreciated.
Rgds,
Art