Results 1 to 3 of 3

Thread: RE:deletion

  1. #1
    Junior Member
    Join Date
    Jun 2007
    Answers
    1

    RE:deletion

    how to delete a word in a file using shell scripting???


  2. #2
    Junior Member
    Join Date
    Jun 2007
    Answers
    9

    Re: deletion

    Hi, you can try with sed and its substitution comand:

    sed -e 's/word_to_be_deleted//' my_file

    the s is the name of the command,
    the expression between the first an second slashes (/) is the pattern to be replaced,
    the expresion between the second and the third slashes (/) is the replacement pattern (in this case nothing).

    The patterns could be regular expressions.

    The standard output is the console, but you can redirect the output to another file using shell redirection. (> my_file_with_word_deleted)

    HTH


  3. #3
    Noel Lastra
    Guest

    Re: deletion

    if you find sed utility command unuseful for that operation, I suggest the use of AWK if you are in the shell scripts.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact