- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- replace a specific line in a file?
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
09-13-2002 06:01 AM
09-13-2002 06:01 AM
The line to be replaced will not have the same content everytime, but the line number will be constant....
Thanks again(!)
Russ.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2002 06:06 AM
09-13-2002 06:06 AM
Re: replace a specific line in a file?
ed filename <
w
q
EOI
Heiner
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2002 06:11 AM
09-13-2002 06:11 AM
Re: replace a specific line in a file?
On quick review I didn't see the exact solution you're looking for, but I'm attaching the "Handy One-liners for Sed" for your future reference (orginally courtesy of Princess Paula).
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2002 06:11 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2002 06:12 AM
09-13-2002 06:12 AM
Re: replace a specific line in a file?
something like this
rep_line "YOUR NEW LINE"
newline=$1
let line=1
while read line
do
if [ $line -eq 40 ]
then
echo $newline
else
echo $line
fi
let line =$line + 1
done
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2002 06:15 AM
09-13-2002 06:15 AM
Re: replace a specific line in a file?
Hi
something like this
rep_line "YOUR NEW LINE"
newline=$1
let n=1
while read line
do
if [ $n -eq 40 ]
then
echo $newline
else
echo $line
fi
let n =$n + 1
done