•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the Shell Scripting section within the Software Development category of DaniWeb, a massive community of 426,898 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,338 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Shell Scripting advertiser: Programming Forums
Views: 714 | Replies: 1
![]() |
| |
•
•
Join Date: May 2008
Posts: 1
Reputation:
Rep Power: 0
Solved Threads: 0
Hi
I want to grep for a line and copy and paste that line.
for Example
---- file abc.txt ----
host=atlx1 sid=atld1 mail=abc@abc.com
host=atlx2 sid=atld2 mail=xyz@abc.com
host=atlx3 sid=atld3 mail=def@abc.com
host=atlx4 sid=atld4 mail=mno@abc.com
--- end of file abc.txt ----
Now I want to grep line with host=atlx3 and sid=atld3 and copy and paste the line and ALSO put "#" in front of one of the line. The following is the output I would like to see...
---- file output.txt ----
host=atlx1 sid=atld1 mail=abc@abc.com
host=atlx2 sid=atld2 mail=xyz@abc.com
#host=atlx3 sid=atld3 mail=def@abc.com
host=atlx3 sid=atld3 mail=def@abc.com
host=atlx4 sid=atld4 mail=mno@abc.com
--- end of file output.txt ----
How can I do this in shell script.
Thanks in advance for your help.
RK
I want to grep for a line and copy and paste that line.
for Example
---- file abc.txt ----
host=atlx1 sid=atld1 mail=abc@abc.com
host=atlx2 sid=atld2 mail=xyz@abc.com
host=atlx3 sid=atld3 mail=def@abc.com
host=atlx4 sid=atld4 mail=mno@abc.com
--- end of file abc.txt ----
Now I want to grep line with host=atlx3 and sid=atld3 and copy and paste the line and ALSO put "#" in front of one of the line. The following is the output I would like to see...
---- file output.txt ----
host=atlx1 sid=atld1 mail=abc@abc.com
host=atlx2 sid=atld2 mail=xyz@abc.com
#host=atlx3 sid=atld3 mail=def@abc.com
host=atlx3 sid=atld3 mail=def@abc.com
host=atlx4 sid=atld4 mail=mno@abc.com
--- end of file output.txt ----
How can I do this in shell script.
Thanks in advance for your help.
RK
![]() |
•
•
•
•
•
•
•
•
DaniWeb Shell Scripting Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Similar Threads
- Popups, Virtumonde.O? (Viruses, Spyware and other Nasties)
- Help, I have the Hacktool.Rootkit virus !! (Viruses, Spyware and other Nasties)
- Nasty case of Guard.tmp (Viruses, Spyware and other Nasties)
- HiJackThis output (Viruses, Spyware and other Nasties)
- Aurora Virus (Viruses, Spyware and other Nasties)
- Hotoffers get me mad !! (Viruses, Spyware and other Nasties)
- Possible virus (Viruses, Spyware and other Nasties)
- configuring Xfree86? (Window and Desktop Managers)
Other Threads in the Shell Scripting Forum
- Previous Thread: shell script beautifier
- Next Thread: exit (0)


Hybrid Mode