02-24-2005
Searching and Removing File Content
Hi,
I am trying to search a character in a file and remove it from that file....
My file looks something like this:
test1.txt
ckj12300_00|123|var1|10.2
ckj00200_12|444|var2|11.2
ckj00200_14|4556|var3|33.5
c00200_00_000|4558|var4|33.5
ckj00200_14|4553|var5|33.5
c00200_00_000|453|var7|33.5
ckj00200_14|454|var8|33.5
c00200_00_000|4567|var50|40.2
and so on....
I have to find rows that has c00200_00_000 and remove it from file. The file is about 33 MB and there are quite a few rows with c00200_00_000.
I tried grep c00200_00_000 test1.txt >test2.txt .....>This command only finds the c00200_00_000 and puts it in test2.txt but does not remove it from file....
Any help will be appreciated.....
10 More Discussions You Might Find Interesting
1. UNIX for Advanced & Expert Users
Please help. Here is my problem. I have 9000 lines in file a and 500,000 lines in file b. For each line in file a I need to search file b and remove that line. I am currently using the grep -v command and loading the output into a new file. However, because of the size of file b this takes an... (2 Replies)
Discussion started by: mjs3221
2 Replies
2. UNIX for Dummies Questions & Answers
Hi,
This question may be quite newbish.
I've stored a few files on my Unix system and am wondering how to search for their contents (i.e. I input the keyword and get a list of files with this keyword)
I'd then like to put it on my website (php).
I thought of find and grep, but am not... (19 Replies)
Discussion started by: Aretai
19 Replies
3. UNIX for Dummies Questions & Answers
I have a file which looks like
AA BB CC DD EE FF GG HH KK
AA BB GG HH KK FF CC DD EE
AA BB CC DD EE UU VV XX ZZ
AA BB VV XX ZZ UU CC DD EE
....
I want the script to give me only one line based on duplicate contents:
AA BB CC DD EE FF GG HH KK
AA BB CC DD EE UU VV XX ZZ (7 Replies)
Discussion started by: adsforall
7 Replies
4. Shell Programming and Scripting
Hi
I was wondering why command 2 doesn't work like command 1 below.
1.
find . -exec grep "test" '{}' \; -print
2.
ls -R | grep "test"
I am trying to search "test" from all the files in the current and sub directories. What's wrong with my command 2?
Thanks in advance for your help (4 Replies)
Discussion started by: tiger99
4 Replies
5. Shell Programming and Scripting
I generally save a lot of web pages for reading offline which works out great for school. Now I have to spend a lot of time on the bus and I am looking for the best way to read some of these webpages using my Nokia 7610.
I have uploaded the files to my phone, but they are deadly deadly slow to... (2 Replies)
Discussion started by: naphelge
2 Replies
6. Shell Programming and Scripting
without using conventional file searching commands like find etc, is it possible to locate a file if i just know that the file that i'm searching for contains a particular text like "Hello world" or something? (5 Replies)
Discussion started by: arindamlive
5 Replies
7. UNIX for Advanced & Expert Users
Consider i have 2 directories a1 and a2.
under a1, i have below files
test1
test2
test3.
Under a2,i have below files.
test1
test2
test3
test4
test5My requirement is i will pass the directory names(2 parameters) and directory in which files needs to be removed.(3rd parameter)
a)first... (11 Replies)
Discussion started by: pandeesh
11 Replies
8. Red Hat
Hello,
Please help me with this!! Thanks in advance!!
I have a file named file.gc with the content:
1-- Mon Sep 10 08:53:09 CDT 2012
2revoke connect from FR2261;
3delete from mkt_allow where grantee = 'FR2261';
4grant connect to FR2261 with '******';
5alter user FR2261 comment... (0 Replies)
Discussion started by: raosr020
0 Replies
9. Shell Programming and Scripting
I have two files:
file 1:
hello.com neo.com,japan.com,example.com
news.net xyz.com, telecom.net, highlands.net, software.com
example2.com earth.net, abc.gov.uk
file 2:
neo.com
example.com
abc.gov.uk
file 2 are the search keys to search in file 1 if any of the search key is... (3 Replies)
Discussion started by: csim_mohan
3 Replies
10. Shell Programming and Scripting
so i'm running a variation of the following command a few times in my script:
echo "${TOTALRunning}" | awk -F"" '/'"${PROCSEARCH}"'/ {print $2}' | tr '\n' '|'
unfortunately i cant paste the content of the variable TOTALRunning into this thread for security reasons.
what i want to do is... (9 Replies)
Discussion started by: SkySmart
9 Replies