sed error - using reserved letters


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting sed error - using reserved letters
# 1  
Old 05-07-2008
sed error - using reserved letters

Hi All,

below is my data file
file.txt
Code:
0     ServerA  LAN1    AAA     IT01    04/30/2008  09:16:26
               (no records)  
0     ServerB  LAN1    AAA     IT02    04/30/2008  09:16:26
0     ServerA  LAN1    AAA     IT01    04/30/2008  11:11:26
0     ServerB  LAN1    AAA     IT02    04/30/2008  11:11:26
               (no records) 
0     ServerA  LAN1    AAA     IT01    04/29/2008  12:16:26
0     ServerB  LAN1    AAA     IT02    04/30/2008  12:16:26

i tried to replace with null for the above string (no records) using sed, received following error
Code:
# sed "s/(*\)//g" file.txt
sed: command garbled: s/(*\)//g

Any one can help

Thanks in advance
# 2  
Old 05-07-2008
Why not just grep -v 'no records' file.txt > newfile.txt?
# 3  
Old 05-07-2008
sed 's/(.*)//g' file.txt

--penchal
# 4  
Old 05-07-2008
hi anni,
characters inside (xxxx) are variables. so no point to grep

hi penchal,
Thanks it works fine,

is there any way to remove the whole line instead of replacing null
# 5  
Old 05-07-2008
Code:
sed '/(.*)/d' file.txt

Or:

Code:
grep -v '(.*)' file.txt

(grep understands regexp too).
# 6  
Old 05-07-2008
Hi Karthik,

sed '/(.*)/d' file.txt


--penchal
# 7  
Old 05-07-2008
hey
thanks to all
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Regex for one to four letters (sed) not GNUsed

I have regular sed on my computer. I am trying to find out a regex for one-four letters. I have tried (\{1,4\} This will match one or four characters, but what if the expression has two characters? Like AB1234 I don't have GNUsed and am having trouble with this regex. (5 Replies)
Discussion started by: newbie2010
5 Replies

2. UNIX for Dummies Questions & Answers

sed - extract a group of Letters/numbers

I have a file with hundreds of lines in it. I wanted to extract anything that matches the following: KR followed by 4 digits: example KR1201 cat list | sed "s///g" Is the closest I've come, and obviously it is not what I want. This would remove all of the items that I want and leave me... (2 Replies)
Discussion started by: newbie2010
2 Replies

3. UNIX for Dummies Questions & Answers

Selective Replacements: Using sed or awk to replace letters with numbers in a very specific way

Hello all. I am a beginner UNIX user who is using UNIX to work on a bioinformatics project for my university. I have a bit of a complicated issue in trying to use sed (or awk) to "find and replace" bases (letters) in a genetics data spreadsheet (converted to a text file, can be either... (3 Replies)
Discussion started by: Mince
3 Replies

4. AIX

Question about reserved memory

Hi! maybe a stupid question but i recall fixing this issue before (or something similar), On one of my frames I have a huge amount of reserved memory. 25GB to be exact. I am running out of memory and need to add a new lpar. I can't remember exactly how i fixed this issue before and it's... (2 Replies)
Discussion started by: vpundit
2 Replies

5. Shell Programming and Scripting

sed command, look for numbers following letters

If I have a set of strings, C21 F231 H42 1C10 1F113 and I want to isolate the ints following the char, what would the sed string be to find numbers after letters? If I do, *, I will get numbers after letters, but I am looking to do something like, sed 's/*/\t*/g' this will give me... (14 Replies)
Discussion started by: LMHmedchem
14 Replies

6. Shell Programming and Scripting

Put parentheses around all capital letters using SED

Hello everyone I tell you that I'm trying to do a bash program that can put parentheses around each capital letter of each line using SED. I tell you probe with: sed -e '1,$s/A/(A)/g' "$file" but only add parentheses in A. then tested with: sed 'y/AB/(A)(B)/' "$archivo" but it... (3 Replies)
Discussion started by: adiegorpc
3 Replies

7. Solaris

/dev/rmt/0mn: write protected or reserved

# mt stat HP DDS-4 DAT (Sun) tape drive: sense key(0x0)= No Additional Sense residual= 0 retries= 0 file no= 0 block no= 0 mt -f /dev/rmt/0mn erase /dev/rmt/0mn: write protected or reserved. Getting error while ufsdump .... --- Dumping / to /dev/rmt/0mn --- DUMP: Date... (5 Replies)
Discussion started by: vickyingle5
5 Replies

8. Hardware

/dev/rmt/0mn: write protected or reserved

# mt stat HP DDS-4 DAT (Sun) tape drive: sense key(0x0)= No Additional Sense residual= 0 retries= 0 file no= 0 block no= 0 mt -f /dev/rmt/0mn erase /dev/rmt/0mn: write protected or reserved. Getting error while ufsdump .... --- Dumping / to /dev/rmt/0mn --- DUMP: Date... (1 Reply)
Discussion started by: vickyingle5
1 Replies

9. Shell Programming and Scripting

chkcount variable in bash reserved?

Hi, im experiencing a really strange thing: _____________________________ #!/bin/bash chkcount=0 chkcountmax=3 while ((chkcount < chkcountmax)) do echo "chkcount=$chkount" echo "chkcountmax=$chkountmax" ((chkcount++)) done... (1 Reply)
Discussion started by: tho99
1 Replies

10. UNIX for Advanced & Expert Users

NFS and NIS reserved ports

Does anyone know how to assign rpc ports to NFS or NIS processes on Solaris please ? Thanks, Michael Chnader (0 Replies)
Discussion started by: mchnaider
0 Replies
Login or Register to Ask a Question