Sponsored Content
Top Forums Shell Programming and Scripting Find and delete a certain HEX and its following value in a file Post 303013019 by Chubler_XL on Tuesday 13th of February 2018 08:24:56 PM
Old 02-13-2018
You can try:

Code:
LC_ALL=C sed "s/[\x01].//g" text_file > fixed_text_file

Testing example:
Code:
$ printf "Test:%b%b\n" "\x1" "\x90" | od -c
0000000   T   e   s   t   : 001 220  \n
0000010

$ printf "Test:%b%b\n" "\x1" "\x90" | LC_ALL=C sed "s/[\x01].//g" | od -c
0000000   T   e   s   t   :  \n
0000006

This User Gave Thanks to Chubler_XL For This Post:
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

find and delete reccuring entries in a file

I have a file with multiple lines, lets say for example magazine1 magazine2 magazine3 magazine3 magazine4 magazine5 So i am trying to find a way to find and delete the duplicate entries. Any ideas? Thanks (3 Replies)
Discussion started by: greekozz
3 Replies

2. Shell Programming and Scripting

find full directory and delete old dated file?

I want to write a code that will look for a particular directory which is full or more than 95% used, and will search older file and delete it. My code looks like this: df -k|while read f1 f2 f3 f4 f5 f6 do if expr '$f5' -ge '95%' || continue then echo $f5 else echo "there is no... (2 Replies)
Discussion started by: xramm
2 Replies

3. UNIX for Dummies Questions & Answers

find and delete a file in one command

hi , let's assume i have a file that is located in the l*** directory and this file's name is t****_***s.php , how can i find this file and delete it using one single command ????? (3 Replies)
Discussion started by: wewee
3 Replies

4. Shell Programming and Scripting

To find a word in a file and delete the file

Hi, I need to find a word in a file, and I need to delete the file where the word resides on the file. I did try with the grep -H "word" using the find command, but no luck. (6 Replies)
Discussion started by: gsiva
6 Replies

5. Programming

After converting the hexstr to Hex and storing the Hex in a char*

Hi All, My main intension of is to convert the Hexstring stored in a char* into hex and then prefixing it with "0x" and suffix it with ',' This has to be done for all the hexstring char* is NULL. Store the result prefixed with "0x" and suffixed with ',' in another char* and pass it to... (1 Reply)
Discussion started by: rvan
1 Replies

6. Programming

What is the difference between ios::hex and std::hex?

Hi, Is there really a difference between these two, std::hex and ios::hex?? I stumbled upon reading a line, "std::ios::hex is a bitmask (8 on gcc) and works with setf(). std::hex is the operator". Is this true? Thanks (0 Replies)
Discussion started by: royalibrahim
0 Replies

7. Shell Programming and Scripting

Find the text in the file and delete the rest of the line.

Hi, I have one requiremnet like this. I need to find some particular string (eg.IncludeDateTime = ) in a file. And wherever it finds the string the unix script has to delete the remaining text coming after the string (ie., 'IncludeDateTime = ' ) in the same line. I tried to write this script in... (5 Replies)
Discussion started by: jannusuresh
5 Replies

8. Shell Programming and Scripting

Find and delete file previous to some date

Hello All, I have a directory containing of many .dat file, but with different naming conventions. I want to delete files which are created before and on 10th September 2013. I tried this command to see files which are are the files created before 10th September find path/to/file -type... (6 Replies)
Discussion started by: nnani
6 Replies

9. Shell Programming and Scripting

Find if file is 45 min old if yes delete

Hello, we have process2(my_pro.sh) which check for the file Pr_rn_Chk (generated by other process1). The process runs every 15 min. if exist Pr_rn_Chk the process will exit. Else it will continue. I want to check if the file Pr_rn_Chk is older than 45 min delete the file. so that 4th run... (3 Replies)
Discussion started by: kumar30213
3 Replies

10. Shell Programming and Scripting

Find and increment value in string of hex

I have a long string of hex (from ASN.1 data) where I need to find and change a particular hex value only and increment it. The hex pairs either side (84 and a7) of the value to increment will remain constant. i.e. "84 <length> <value_to_increment> a7" starting with 00. So end result: ... (11 Replies)
Discussion started by: securegooner
11 Replies
File::Find::Rule::Perl(3)				User Contributed Perl Documentation				 File::Find::Rule::Perl(3)

NAME
File::Find::Rule::Perl - Common rules for searching for Perl things SYNOPSIS
use File::Find::Rule (); use File::Find::Rule::Perl (); # Find all Perl files smaller than 10k my @files = File::Find::Rule->perl_file ->size('<10Ki') ->in('dir'); # Locate all the modules that PAUSE will index my @mod = File::Find::Rule->no_index ->perl_module ->in('My-Distribution'); DESCRIPTION
I write a lot of things that muck with Perl files. And it always annoyed me that finding "perl files" requires a moderately complex File::Find::Rule pattern. File::Find::Rule::Perl provides methods for finding various types Perl-related files, or replicating search queries run on a distribution in various parts of the CPAN ecosystem. METHODS
perl_module The "perl_module" rule locates perl modules. That is, files that are named "*.pm". This rule is equivalent to "->"file->name( '*.pm' )> and is included primarily for completeness. perl_test The "perl_test" rule locates perl test scripts. That is, files that are named "*.t". This rule is equivalent to "->"file->name( '*.t' )> and is included primarily for completeness. perl_installer The "perl_installer" rule locates perl distribution installers. That is, it locates "Makefile.PL" and "Build.PL" files. perl_script The "perl_script" rule locates perl scripts. This is any file that ends in .pl, or any files without extensions that have a perl "hash-bang" line. perl_file The "perl_file" rule locates all files containing Perl code. This includes all the files matching the above "perl_module", "perl_test", "perl_installer" and "perl_script" rules. no_index # Provide the rules directly $rule->no_index( directory => [ 'inc', 't', 'examples' ], file => [ 'Foo.pm', 'lib/Foo.pm' ], ); # Provide a META.yml to use $rule->no_index( 'META.yml' ); # Provide a dist root directory to look for a META.yml in $rule->no_index( 'My-Distribution' ); # Automatically pick up a META.yml from the target directory $rule->no_index->in( 'My-Distribution' ); The "no_index" method applies a set of rules as per the no_index section in a "META.yml" file. SUPPORT
Bugs should always be submitted via the CPAN bug tracker <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=File-Find-Rule-Perl> For other issues, contact the maintainer AUTHOR
Adam Kennedy <adamk@cpan.org> SEE ALSO
<http://ali.as/>, File::Find::Rule, File::Find::Rule::PPI COPYRIGHT
Copyright 2006 - 2012 Adam Kennedy. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The full text of the license can be found in the LICENSE file included with this module. perl v5.16.3 2012-10-31 File::Find::Rule::Perl(3)
All times are GMT -4. The time now is 01:00 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy