- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Script question
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
01-07-2007 09:22 PM
01-07-2007 09:22 PM
I have a bunch of files where i need to replace the 100th Charecter in the fist line of each file by new charecter
Any help will be great
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-07-2007 09:37 PM
01-07-2007 09:37 PM
Re: Script question
cat file.txt | sed -e 's/\(.\{99\}\).\(.*\)/\1Q\2/'
Where the 'Q' is your 'new' character.
Hope that helps,
Cheers
Wout
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-07-2007 09:42 PM
01-07-2007 09:42 PM
Re: Script question
cat file.txt | sed -e '1 s/\(.\{99\}\).\(.*\)/\1Q\2/'
So, to fix all txt files in a directory:
for i in `ls *.txt`
do
cat $i | sed -e '1 s/\(.\{99\}\).\(.*\)/\1Q\2/' > $i
done
Test it first, though ;-)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-07-2007 09:48 PM
01-07-2007 09:48 PM
Re: Script question
sed '1 s/./a/100' a.lis > b.lis
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-07-2007 10:42 PM
01-07-2007 10:42 PM
Re: Script question
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-08-2007 12:08 AM
01-08-2007 12:08 AM
Re: Script question
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-08-2007 02:47 AM
01-08-2007 02:47 AM
Solutionsed -e '/^.\{99\}[ ]/ s/./ your text /100' yourfile.txt
Translation: on lines which start with 99 characters and then have a space, replace the 100th character with " your text ".
Cheers