HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- 'sed' is not working, Please correct me
Operating System - HP-UX
1830938
Members
1804
Online
110017
Solutions
Forums
Categories
Company
Local Language
back
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
back
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
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- 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
11-09-2002 12:12 PM
11-09-2002 12:12 PM
'sed' is not working, Please correct me
Hi to all,
Please do help me. i tried my best but didn't help me. looking forward for help. i have a file name "vv4" and if i run following
commands:
# cat vv4
SCAR on Fox. #
NASCAR Y 48
afsdfsdfsd
sfs
vivek
shrivastava
# cat -vet vv4
SCAR on Fox. #$
^I ^I^I^INASCAR^I^IY^I48$
afsdfsdfsd$
sfs$
vivek$
shrivastava$
you will see that first line is being end with #. what i want just find any line in the file which end with # and append the next line to it.
i tried following command but it is working.
# sed '
> /#$/ {
> N
> s/#n//
> }'vv5
now if run following command to see the out put file
# cat vv5
SCAR on Fox. #
NASCAR Y 48
afsdfsdfsd
sfs
vivek
shrivastava
# cat -vet vv5
SCAR on Fox. #$
^I ^I^I^INASCAR^I^IY^I48$
afsdfsdfsd$
sfs$
vivek$
shrivastava$
evrything is as it is as it was. it didn't merge 2nd line to first becasue first line end with #. please do help me.
waiting for help.
thanks
Please do help me. i tried my best but didn't help me. looking forward for help. i have a file name "vv4" and if i run following
commands:
# cat vv4
SCAR on Fox. #
NASCAR Y 48
afsdfsdfsd
sfs
vivek
shrivastava
# cat -vet vv4
SCAR on Fox. #$
^I ^I^I^INASCAR^I^IY^I48$
afsdfsdfsd$
sfs$
vivek$
shrivastava$
you will see that first line is being end with #. what i want just find any line in the file which end with # and append the next line to it.
i tried following command but it is working.
# sed '
> /#$/ {
> N
> s/#n//
> }'
now if run following command to see the out put file
# cat vv5
SCAR on Fox. #
NASCAR Y 48
afsdfsdfsd
sfs
vivek
shrivastava
# cat -vet vv5
SCAR on Fox. #$
^I ^I^I^INASCAR^I^IY^I48$
afsdfsdfsd$
sfs$
vivek$
shrivastava$
evrything is as it is as it was. it didn't merge 2nd line to first becasue first line end with #. please do help me.
waiting for help.
thanks
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-09-2002 05:08 PM
11-09-2002 05:08 PM
Re: 'sed' is not working, Please correct me
how about trying something using awk
awk '{
if ( $0 ~ "#$" ) {
printf("%s",$0);
getline;
print $0;
}
else print $0;
}'
awk '{
if ( $0 ~ "#$" ) {
printf("%s",$0);
getline;
print $0;
}
else print $0;
}'
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-09-2002 05:19 PM
11-09-2002 05:19 PM
Re: 'sed' is not working, Please correct me
compare these
sed '
/#$/ {
n
}'
and
sed '
/#$/ {
n
p
}'
sed '
/#$/ {
n
}'
and
sed '
/#$/ {
n
p
}'
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-11-2002 09:26 AM
11-11-2002 09:26 AM
Re: 'sed' is not working, Please correct me
Thanks curt!
U have solved my problem.
thanks!!
U have solved my problem.
thanks!!
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP