Skip to main content

SED commad In Linux O.S

                                        SED command In Linux O.S

SED command in UNIX is stands for stream editor and it can perform lot of function on file like searching, find and replace, insertion or deletion. Though most common use of SED command in UNIX is for substitution or for find and replace.


  • Replacing or substituting string

                    sed 's/unix/linux/' a.txt




  • Replacing existing with new characters
             sed 's/<old word><new word>' <txt file>
                       or

             cat <txt file> | sed 's/<old word><new word>'


  • Numbering of txt file and stream edit by sed
                       cat -n <txt file> | sed 's/<old word><new word>'


  • if you want to replace all the message or word in txt file
         sed 's/<old word>/<new word>/g' <txt file>


  • change all first-word according to need of a txt file
          sed 's/^/<new word' <txt file>

                   or

  •     if you want to change in all the line
                sed 's/^/<new word/g' <txt file>



  • when you want to add new word end of each lines
            sed 's/$/<new word want to add> <txt file>
  • When need each line spacing means after every line give one line space 
            sed G a.txt

  • print only selected lines 
          sed -n <selected lines >p <txt file>




  • if you want to delete lines according to need
          sed <no of line>d <txt file>


  • if you want to perform multiple operation user -e synatx
          sed -e '2d' -e 'G'  <txt file>



  • 2 line or more than one line space        


  • search word and change according to you i am changing it to uppercase
         sed 's/<word want to search >/\U&/g' <txt file>

  • use ig for ignoring in same command 





                                                                                                Written By Sanjay Kumar
                                   
                                                                                                       https://www.instagram.com/sanjayer111/
                                                                                                       https://www.facebook.com/mang786
                                                                                                      https://www.linkedin.com/in/sanjaykumar111/

Comments

Popular posts from this blog

exploit rpcbind

                            exploit rpcbind with nfs What is nfs?     Network File System (NFS) is a distributed file system protocol originally developed by Sun Microsystems in 1984,allowing a user on a client computer to access files over a network in a manner similar to how local storage is accessed. NFS, like many other protocols, builds on the Open Network Computing Remote Procedure Call (ONC RPC) system. The Network File System is an open standard defined in RFCs, allowing anyone to implement the protocol. What is rpcbind?     The rpcbind utility maps RPC services to the ports on which they listen. RPC processes notify rpcbind when they start, registering the ports they are listening on and the RPC program numbers they expect to serve. The client system then contacts rpcbind on the server with a particular RPC program number. The rpcbind service redirects the client to the proper port number so it can communicate with the requested service. Because RPC-based services

Exploit and connect to port 512 ,513, and 514

               Exploit and connect to port 512 ,513, and 514 ༄ Unix Basics      TCP ports 512, 513, and 514 are known as "r" services, and have been misconfigured       to allow remote access from any host (a standard ".rhosts + +" situation).       To take advantage of this, make sure the "rsh-client" client is installed (on Ubuntu), and      run the following command as your local root user. If you are prompted for an SSH key,      this means the rsh-client tools have not been installed and Ubuntu is defaulting to       using  SSH. 🔂 Step-1:               First type "nmap -v <victim ip>" 🔄 Step-2:               type "rlogin  -l <user account> <ip address of victim>                                                                          by Er. SANJAY KUMAR                                                                                                            sanjayyadav11210@gmail.com

Exploit Smtp service port 25

                          Exploit SMTP service port 25   ✍️ Total 4 Ways we can exploit Smtp service ✍️ Type  -1 --> metasploit step -1 : Type msfconsole in terminal the it will open metasploit step - 2 type - search smtp step  3 : find auxiliary/scanner/smtp/smtp_enum then use it by use command  ex  msf> use auxiliary/scanner/smtp/smtp_enum   step  4 : Show options -- for requirement identity step  5 : set attribute using set command. ex set rhost <rhostip> Step 6 : exploit/run it using exploit command.                                                                             by Er. Sanjay Kumar ✍️ Type  -2 --> smtp-user-enum smtp-user-enum smtp-user-enum is a tool for enumerating OS-level user accounts on Solaris via the SMTP service (sendmail). Enumeration is performed by inspecting the responses to VRFY, EXPN, and RCPT TO commands. It could be adapted to work against other vu