- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- How to append something to appointed line of ACSII...
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
12-19-2004 06:44 PM
12-19-2004 06:44 PM
For example:
append " 138" to abc.txt must follow "130 131 132 133 134 135 136 137"
original abc.txt
[root@webapp home]# cat abc.txt
130 131 132 133 134 135 136 137
I need execute one or more command under command line to append content of abc.txt.
I wanna abc.txt as following:
[root@webapp home]# cat abc.txt
130 131 132 133 134 135 136 137 138
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-19-2004 08:01 PM
12-19-2004 08:01 PM
Re: How to append something to appointed line of ACSII file use command line?
Regards,
Sergejs
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-19-2004 08:07 PM
12-19-2004 08:07 PM
Re: How to append something to appointed line of ACSII file use command line?
sed s/"137"/"137 138"/ abc.txt > abc_changed.txt
mv -f abc_changed.txt abc.txt
Regards,
Sergejs
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-19-2004 08:26 PM
12-19-2004 08:26 PM
Re: How to append something to appointed line of ACSII file use command line?
I just knew line number , not content.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-19-2004 09:25 PM
12-19-2004 09:25 PM
Re: How to append something to appointed line of ACSII file use command line?
Maybe this script may help (chose your favorite name):
#!/bin/bash
lin=0
while read -e line
do
let "lin += 1"
if [ "$lin" == "$1" ]; then
echo $line$2
else
echo $line
fi
done
Use
# cat abc.txt | script 2 " 138" > newfile
where 2 is line and " 138" is text to append.
Bojan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-19-2004 09:36 PM