how to remove words between /* and */ in several lines of file
hi,
I want to remove comments in somany files. coments started from /* and ends with */. so i wnt to remove words /* to */
how to remove words between /* and */ in several lines of file
EX :
cat haha.txt "HI",/*hk*/ob1,raju,/*hjh*/boju,beeju
output should be : "HI",ob1,raju,boju,beeju
I tried ur code in my machine. Its working fine . But i couldnt understand how it works. Im very new to shell scripting.. even i tried with tutorials.....
Please explain me
1. s@/\*[^/\*]*\*/@@g why [^/\*] this is required?
2. how it checks for multiple lines... becaz i saw in one of the tutorial...label is required to check multiple lines ...
Lets start from the first line of the script.
This removes comments on one line. '[^/\*]' needs to find all symbols, but '/' '*' to the closing comment. Actually, I've missed that in comments could be symbols '/' and '*'. It won't work in this circumstances. '[^/\*]' should be removed...
This line matches opening comment and start section, which is applied to all line, containing '/*' symbols.
This command reads next line and puts it in pattern space.
This line is not necessary here
This substitutes all symbols between '/*' and '*/' to ''.
And it doesn't need label to check two lines. For checking in more than two it needs.
So, final script should looks like this
And finally, try to find book Sed & Awk - it explains all sed stuff
Hi
Can someone tell me which script will work best (in terms of speed and simplicity to write and run) for a large text file to filter all the lines with a minimum specified length of words ? A sample script with be definitely of great help !!! Thanks in advance. :) (4 Replies)
Hello everyone,
Although it seems easy, I've been stuck with this problem for a moment now and I can't figure out a way to get it done.
My problem is the following:
I have a file where each line is a sequence of IP addresses, example :
10.0.0.1 10.0.0.2
10.0.0.5 10.0.0.1 10.0.0.2... (5 Replies)
Hi,
I have a huge file which has Lacs of lines. File system got full.
I want your guys help to suggest me a solution so that I can remove all lines from that file but not last 50,000 lines. I want solution which can remove lines from existing file so that I can have some space left with. (28 Replies)
Dear all,
Greetings.
I would like to ask for your help to extract lines with specific words in addition 2 lines before and after these lines by using awk or sed.
For example, the input file is:
1 ak1 abc1.0
1 ak2 abc1.0
1 ak3 abc1.0
1 ak4 abc1.0
1 ak5 abc1.1
1 ak6 abc1.1
1 ak7... (7 Replies)
Hey Gang-
I have a list of servers. I want to exclude servers that begin with and end with certain characters. Is there an easy command to do this?
Example
wvm1234dev
wvm1234pro
uvm1122dev
uvm1122bku
uvm1344dev
I want to exclude any lines that start with "wvm" OR "uvm" AND end... (7 Replies)
For example, I have a file with below lines containing VOB tags and VOB paths.
* /vobs/fts/FTSUSM20_VOB /ccvobsslx01/projects/vobs/eml/FTSUSM20_VOB
* /vobs/fts/FTS20_VOB /ccvobsslx01/projects/vobs/eml/FTS20_VOB
* /vobs/pmv/PMS_VOB /ccvobsslx01/projects/vobs/cpm/_/PMS_VOB
*... (4 Replies)
dear experts,
Could you please help me to write a command/script to find follwing:
from the log file i want to grep "resCode89270200100001552311" after that only "<resultCode>40614</resultCode>"
it will be like that:
resCode89270200100001552311
<resultCode>40614</resultCode>
... (7 Replies)
Hi,
how could you go about removing words that begin with a certain character.
assuming that this character is '-' I currently have
echo "-hello" | sed s/-/""/
which replaces the leading dash with nothing but I want to remove the whole word, even if there are multiple words beginning... (3 Replies)
Hello,
I have a question:
I have two different files, let's call them file1 and file2. file1 contains a list of words, the words are on seperate lines:
word1
word2
word3
word4
etc...
file2 also contains a list of words, seperated in the same way as file1.
What I want to do is... (5 Replies)
Hi all,
I need help in doing this scenario. I have two files with multiple lines. I want to compare these two files but ignoring the lines which have words like Tran, Loc, Addr, Charge. Also if i have a word Credit in line, i want to tokenize (i.e string after character "
... (2 Replies)