Help required in creating a shell script that filters the unwanted pattern


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Help required in creating a shell script that filters the unwanted pattern
# 1  
Old 12-03-2008
Help required in creating a shell script that filters the unwanted pattern

Kindly help,

Suppose i am having a file that has got the following contents. Is there any way (eg. sed command) to remove the (*) (*any number) pattern.

se.bas

tulf.h
(1)
tuna.c
(1)
tunsim.c
(1)
tus.cpp
(1)
vp.c
(1)
vp.h
(1)
vpi.
(1)
vpi.SEQ
(1)
vpi.c
(1)
wr_now_seq.cpp
(1)
xltgrimm.cpp
(4)
xlttulf.cpp
(2)

Currently i am using a shell script to prepare the above document, but i am stuck up with removing the (*) patterns. Once this is solved i will get a list containing the source code names alone.

list=`cat $1`
for x in $list; do
echo $x | sed '/MAINTENANCE/s///g'| cut -c1-19 | sed '/ /s///g'
done

Thanks in advance.SmilieSmilie
# 2  
Old 12-03-2008
Try:

Code:
sed "/^([0-9][0-9]*)/d" se.bas

Which will search for all lines starting with "(" followed by numbers,
followed by a ")" and delete it.

Most probably one can replace you whole chain of commands by one
sed command.

HTH Chris
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Creating an excel file with filters using shell script.

Hi All, I am new to shell scripting. I have made a script that can convert an excel file from cvs file. This excel file contains hundreds of records and i would like the reader to be able to filter. Is it possible to create an excel file with filters? or that functionality has not been... (3 Replies)
Discussion started by: Marvin159875321
3 Replies

2. Programming

Creating filters with Python on excel

Hello, I have an excel sheet with 11 tabs. I need to take data from the first tab and write the output to the second tab. The first tab looks like this, starting from Row 3 The filters that needs to be created are 1) keep anything greater than 'POS' 5 and less than 160 AND 2)... (2 Replies)
Discussion started by: nans
2 Replies

3. UNIX for Dummies Questions & Answers

Shell script required

Hi, I need shell script for getting the date in format from below text output IP IS 10.238.52.65 pun-ras-bng-mhs-01#show conf port 2/4 Building configuration... Current configuration: ! card ge3-4-port 2 ! port ethernet 2/4 no shutdown encapsulation dot1q (7 Replies)
Discussion started by: surender reddy
7 Replies

4. Shell Programming and Scripting

help required with shell script

Hi, My input file as follws $ cat 1.txt ------- a aa aaa 11 b bb bbb 22 I am able to extract first and last column of a given line as follows. $ nawk '{print $1}' FS= RS= 1.txt | awk '{ $NF = ""; print }' a $ nawk '{print $1}' FS= RS= 1.txt | awk '{ print $NF}' 11 however, the... (4 Replies)
Discussion started by: bala123
4 Replies

5. Shell Programming and Scripting

Help required for creating script.

I want to create a shell script which should be doing following things .. i have the commands but do not know how to tie them up together. 1. . Go to a pre-defined directory and look for a specific pattern txt files like abc12* and select the latest file with abc12* ls |awk '{if($NF... (4 Replies)
Discussion started by: fugitive
4 Replies

6. Shell Programming and Scripting

shell script required...

There are two fields actually one is server name and the other one is Time. Based on time, there are 8 columns and these will be updated with the flag 1 if at all if there is any server name. Time Server name 15 to 18 18 to 21 21 to 24 00 to 03 03 to 06 06 to 09 09 to 12 Server... (3 Replies)
Discussion started by: venkatesht
3 Replies

7. Shell Programming and Scripting

plz help me by creating required shell script

Dear all I am new to shell script. And this is my first post to this site as well as this forum. I would like to tell this forum that I require shell script, which is regarding transfers of files from a specific directory in a server A to server B on a specific directory through sftp command.... (5 Replies)
Discussion started by: girish.batra
5 Replies

8. Linux

shell script required

Hi, iam presenting the input text file format.Of this i need the character count of the number of characters present in each file.The attached file is a combination of 3 text file.each text file starts at record 1 - 34, then the next tetx file starts. What i need is the character count of each... (1 Reply)
Discussion started by: sethunath
1 Replies

9. Shell Programming and Scripting

shell script required

hi , i need a shell script that will remove the first and second lines of the text file and will list the word count of the characters present in it. the text file will be consisting of multiple textfiles.the first text file starts from 01-34.like wise the next file also starts from 01-34... (4 Replies)
Discussion started by: sethunath
4 Replies

10. Shell Programming and Scripting

Help ! Script creating unwanted file

I have a script on a SUN box running OS 5.9 When I run it the script will complete with no errors BUT.... it seems that for some reason it creates a file called " 0 ". This file is empty (has 0 bytes). Has anyone else had this happen and what am I doing that may be causing this??? Thanks in... (2 Replies)
Discussion started by: boppr6470
2 Replies
Login or Register to Ask a Question