Remove specific content in a file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Remove specific content in a file
# 1  
Old 08-10-2009
Tools Remove specific content in a file

Hi, I have a file called fl_list consists of files i have to archive. I want to create a exception parm called except_parm, so if it finds the directory it will not archive these files and remove from fl_list.

$ cat fl_list
/apps/dev/ihub/ready/IA003B/IA003B_Deal_Header_yyyymmdd_hhmmss.txt
/apps/dev/ihub/ready/IA003B/IA003B_DEALROOT_DELTAS_yyyymmdd_hhmmss.txt
/apps/dev/ihub/ready/IA003C_DEAL_PRODUCT_UPDATES.txt
/apps/dev/ihub/ready/IA003C/IA003C_DUP_DELETE_KEYS_yyyymmdd_hhmmdd.txt
/apps/dev/ihub/ready/IA003C/IA003C_FINAL_FILE_yyyymmdd_hhmmss.txt
/apps/dev/ihub/ready/IA003E/IA003E_FINAL_FILE_yyyymmdd_hhmmss.txt
/apps/dev/ihub/ready/IA003E/IA003E_PRODUCT_STORE_LIST_UPDATES.txt
/apps/dev/ihub/ready/IA003F/testsource.txt
/apps/dev/ihub/ready/IA003D/IA003D_DEAL_PRODUCT_COMMENTS_20090416_111111.txt
/apps/dev/ihub/ready/IA003D/IA003D_DEAL_PRODUCT_COMMENTS_20090423_111111.txt
/apps/dev/ihub/ready/IA003D/IA003D_DEAL_PRODUCT_COMMENTS_20090423_111112.txt
/apps/dev/ihub/ready/IA003D/IA003D_DEAL_PRODUCT_COMMENTS_WHOLE_TABLE_20090601_111111.txt
/apps/dev/ihub/ready/IA003D/IA003D_DEAL_PRODUCT_COMMENTS_TIMESTAMP.txt
/apps/dev/ihub/ready/IA003D/IA003D_DEAL_PRODUCT_COMMENTS_TIMESTAMP_20090601_111111.txt
/apps/dev/ihub/ready/IA010/IA010_source_test.txt

$ cat except_parm
IA010
IA003F

Thank you!
# 2  
Old 08-10-2009
Use grep with the options -f and -v, check your man page.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to remove exisiting file content from a file and have to append new file content?

hi all, i had the below script x=`cat input.txt |wc -1` awk 'NR>1 && NR<'$x' ' input.txt > output.txt by using above script i am able to remove the head and tail part from the input file and able to append the output to the output.txt but if i run it for second time the output is... (2 Replies)
Discussion started by: hemanthsaikumar
2 Replies

2. Shell Programming and Scripting

How to remove content present in between specific pattern ?

Hi, I have a file with following pattern. We are looking to filter out only specific content from this file. sample BLAdmins Server.* LinuxAdmins Server.* Policy Name: Recommended Default ACL Policy Everyone ACLPushJob.Read Everyone ACLTemplate.Read Everyone ... (9 Replies)
Discussion started by: Litu19
9 Replies

3. Shell Programming and Scripting

Extracting content from a file in specific format

Hi All, I have the file in this format **** Results Data **** Time or Step 1 2 20 0.000000000e+00 0s 0s 0s 1.024000000e+00 Us 0s 0s 1.100000000e+00 1s 0s 0s 1.100000001e+00 1s 0s 1s 2.024000000e+00 Us Us 1s 2.024000001e+00 ... (7 Replies)
Discussion started by: diehard
7 Replies

4. Shell Programming and Scripting

split file content into specific folders

Hi I have a large text file and I want to split its content into multiple flies. this large file contains several blocks of codes separated by a comment line for each block. this comment line represents a directory path So, when separate these blocks each into a separate file, This output... (7 Replies)
Discussion started by: turki_00
7 Replies

5. Shell Programming and Scripting

want to print the file content from the specific line

Hi All, I would like to print the content from the specific line of a file . For example... i have file abc.txt which has 100 lines of code ,from this file i would like to print the content from 20,19,18th line......like that Regards Srikanth (4 Replies)
Discussion started by: srikanthg
4 Replies

6. Shell Programming and Scripting

Edit file content at the specific line.

How to edit file content at the specific line? For example at below The things to edit --> This is line 2. And it is below line 1. This is line 1. This is line 2. # i want to append some words at this row line. How? This is line 3. (8 Replies)
Discussion started by: alvin0618
8 Replies

7. Shell Programming and Scripting

Remove specific pattern header and its content problem facing

Input file: >TRACK: Position: 1 TYPE: 1 Pos: SVAVPQRHHPGGTVFREPIIIPAIPRLVPGWNKPIIIGRHAFGDQYRATDRVIPGPGKLE LVYTPVNGEPETVKVYDFQGGGIAQTQYNTDESIRGFAHASFQMALLKGLPLYMSTKNTI LKRYDGRFKDIFQEIYESTYQKDFEAKNLWYEHRLIDDMVAQMIKSEGGFVMALKNYDGD >TRACK: Position: 1 TYPE: 2 Pos: FAHASFQMALLKGLPLYMS... (8 Replies)
Discussion started by: patrick87
8 Replies

8. Shell Programming and Scripting

Extract specific content from a file

My input file: >sequence_1 ASSSSSSSSSSSDDDDDDDDDDDCCCCCCC ASDSFDFFDFDFFWERERERERFSDFESFSFD >sequence_2 ASDFDFDFFDDFFDFDSFDSFDFSDFSDFDSFASDSADSADASD ASDFFDFDFASFASFASFAFSFFSDASFASFASFAFS >sequence_3 VEDFGSDGSDGSDGSDGSDGSDGSDG dDFSDFSDFSDFSDFSDFSDFSDFSDF SDGFDGSFDGSGSDGSDGSDGSDGSDG My... (22 Replies)
Discussion started by: patrick87
22 Replies

9. AIX

find for specific content in file in the directory and list only file names

Hi, I am trying to find the content of file using grep and find command and list only the file names but i am getting entire file list of files in the directory find . -exec grep "test" {} \; -ls Can anyone of you correct this (2 Replies)
Discussion started by: madhu_Jagarapu
2 Replies

10. Shell Programming and Scripting

Remove content from file

hey all, I have a file with records in following format 8-29-2006 13:01:45|ABC|45 8-29-2006 14:23:12|DEF|21 8-30-2006 00:04:57|ABC|34 I want to remove all yesterday records. Can anyone show me how? Thanks! (10 Replies)
Discussion started by: mpang_
10 Replies
Login or Register to Ask a Question