Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations dencom on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search results for query: *

  1. whatisthis987

    SED - find and replace between patterns

    Hi, I would like to search between "aaa" and ";" for "ccc ddd" and replace it with a blank. To me, each "line" of interest begins with "aaa" and ends with a semicolon ";". For example, aaa 111 222 ccc ddd; sdfs fdd ccc ddd; sfsdf dfdf fdf dfff dfsdfs fdfd; aaa dfg ccc ccc ddd; aaa ddd ccc ccc...
  2. whatisthis987

    How do I replace just the second pattern?

    Hi, I have a file looks like this: aaa bbb ccc ddd; 123 321 423 444; aaa eee ccc ddd; aaa fff ccc ddd; 12243455465467; I want the output to look like this: aaa bbb; 123 321 423 444; aaa eee; aaa fff; 12243455465467; Basically, just remove the last 2 entries of the lines begin with "aaa" but...
  3. whatisthis987

    Addition

    Hi, I have a file that looks like this: textxxxxxx abc 100 200 text again.....300 100 more text...... (5853.2775,2960.825) (5853.275, 2960.82) (5853.28, 2960.83) (6185.3225,6330.975) (6185.32, 6330.97) (6185.325, 6330.98) I would like to add 10 to the numbers of...
  4. whatisthis987

    How to subtract only the lines with 2 numerical columns

    Hi, I have a file that looks like this: line1 - This is line #1 line1 - This is line #1 11 11 11 500 600 600 700 700 800 line7 - This is line #7 line8 - This is line #8 I would like to subtract 10 ONLY from the lines with 2 numerical columns. Meaning it should look like this: line1 - This is...
  5. whatisthis987

    How to break a file into pieces?

    Hi, I have a file that looks like this: Par1 sdfsdff c 568768 dfdfdfdty6v 655 dfdsdfd 1243 END1abcd Par2 tyrtyrfghgfh rtytrfg gffg gfhjkk dffg END2abcd I would like to write a TCL script to split what's between Par and END into seperate files. For example, ::File Par1.txt:: Par1 sdfsdff c...
  6. whatisthis987

    How to print one line before and one line after certain pattern?

    Hi guys, I would like to print the line before and the line after "JohnDoe" is found. For example, ===Input text file=== line1 line2 JohnDoe blah blah blah line4 line5 ===Desired output file=== line2 line4 Can someone suggest a good way of doing this?
  7. whatisthis987

    How do I remove duplicate values?

    Thanks in advance for any help. What I want... Input file: John line1 John line2 John line3 Mary line4 Mary line5 Walter line6 Jack line7 Jack line8 Output file: John line1 line2 line3 Mary line4 line5 Walter line6 Jack line7 line8 Keep everything in $2 the same. Only...
  8. whatisthis987

    How do find and delete lines?

    I have fileA consists of keywords: aaa bbb ccc And fileB consists of fulldata I would like to the lines in fileB that contains any of the fileA keywords. For example, line1 sdfffffffff line2 sdfaaaaaaaa line3 sdfghhrwwww The output should be line1 sdfffffffff line3 sdfghhrwwww Please help...
  9. whatisthis987

    How do I swap data between 2 columns?

    datafile From: a b c d e f To: b a d c f e Please help. Thanks.
  10. whatisthis987

    How do I insert strings in a file with SED?

    Hi, I have a script that does substituion with s command. eg: #!/bin/sed -f s/regexp/replacement/ so at Unix/Linux prompt, %>./script original_file >new_file It works like a charm but I also need to add strings/texts to the new_file. How do I do it in the same script? Please help.
  11. whatisthis987

    How to PRINTF special characters?

    Hi, == Beginning of name_list.file === ALAN* ALEX? BEN == end of name_list.file == == Beginninf of Shell script == set name_list = name_list.file foreach mm (`cat ${name_list}`) printf \" >> output_file printf $mm >> output_file printf \" >> output_file printf "...
  12. whatisthis987

    How to cat/echo multiple entries into a string?

    I have a file which contains one name in each line. I would like to cat/echo all the names to one single line. How do I do that? For example, From: ALAN ALEX BEN To: ALAN ALEX BEN Please help. Thanks.

Part and Inventory Search

Back
Top