Sponsored Content
Top Forums Shell Programming and Scripting Count specific character of a file in each line and delete this character in a specific position Post 303021367 by RudiC on Wednesday 8th of August 2018 12:39:44 PM
Old 08-08-2018
I have to second vgersh99 in that your sample data should be refined. There should be lines that don't match either of your criteria. Right now, all file2 lines have a match and will be selected, and all have 64 separators. On top, with the sample given, removing the 61. separator or 60. or 62. wouldn't make a difference as they all are grouped together.
 

10 More Discussions You Might Find Interesting

1. HP-UX

count occurences of specific character in the file

For counting the occurences of specific character in the file I am issuing the command grep -o 'character' filename | wc -w It works in other shells but not in HP-UX as there is no option -o for grep. What do I do now? (9 Replies)
Discussion started by: superprogrammer
9 Replies

2. Shell Programming and Scripting

Count specific character(s) very large file

I'm trying to count the number of 2 specific characters in a very large file. I'd like to avoid using gsub because its taking too long. I was thinking something like: awk '-F' { t += NF - 1 } END {print t}' infile > outfile which isn't working Any ideas would be great. (3 Replies)
Discussion started by: dcfargo
3 Replies

3. Shell Programming and Scripting

Print lines with specific character at nth position in a file

I need to print lines with character S at nth position in a file...can someone pl help me with appropriate awk command for this (2 Replies)
Discussion started by: manaswinig
2 Replies

4. Shell Programming and Scripting

Print lines with specific character at nth position in a file

I need to print lines with character S at nth position in a file...can someone pl help me with appropriate awk command for this (1 Reply)
Discussion started by: manaswinig
1 Replies

5. Shell Programming and Scripting

Insert character in a specific position of a file

Hi, I need to add Pipe (|) at 5th and 18th position of all records a file. How can I do this? I tried to add it at 5th position using the below code. It didnt work. Please help!!! awk '{substr($0,5,1) ~ /|/}{print}' $input_file > $temp_file (1 Reply)
Discussion started by: gpaulose
1 Replies

6. Shell Programming and Scripting

Using sed to replace specific character and specific position

I am trying to use sed to replace specific characters at a specific position in the file with a different value... can this be done? Example: File: A0199999123 A0199999124 A0199999125 Need to replace 99999 in positions 3-7 with 88888. Any help is appreciated. (5 Replies)
Discussion started by: programmer22
5 Replies

7. UNIX for Advanced & Expert Users

Count specific word or character per line

Hi, I need help regarding counting specific word or character per line and validate it against a specific number i.e 10. And if number of character equals the specific number then that line will be part of the output. Specific number = 6 Specific word or char = || Sample data:... (1 Reply)
Discussion started by: janzper
1 Replies

8. Shell Programming and Scripting

Delete line based on count of specific character

I'm looking for what I hope might be a one liner along these lines: sed '/a line with more than 3 pipes in it/d' I know how to get the pipe count in a string and store it in a variable, but I'm greedy enough to hope that it's possible via regex in the /.../d context. Am I asking too much? ... (5 Replies)
Discussion started by: tiggyboo
5 Replies

9. Shell Programming and Scripting

Delete character on specific position

Hi, im still new in unix. i want to ask how to delete character on specific position in line, lets say i want to remove 5 character from position 1000, so characters from position 1000-1005 will be deleted. i found this sed command can delete 4 characters from position 10, but i dont know if... (7 Replies)
Discussion started by: bluesue
7 Replies

10. Post Here to Contact Site Administrators and Moderators

Search for a pattern and replace a space at specific position with a Character in File

In file, we have millions of records each of 1000 in length. And at specific position say 800 there is a space, we need to replace it with Character X if the ID in that row starts with 123. So far i have used the below which is replacing space at that position to X but its not checking for... (3 Replies)
Discussion started by: Jagmeet Singh
3 Replies
PERF-DIFF(1)							    perf Manual 						      PERF-DIFF(1)

NAME
perf-diff - Read perf.data files and display the differential profile SYNOPSIS
perf diff [baseline file] [data file1] [[data file2] ... ] DESCRIPTION
This command displays the performance difference amongst two or more perf.data files captured via perf record. If no parameters are passed it will assume perf.data.old and perf.data. The differential profile is displayed only for events matching both specified perf.data files. OPTIONS
-D, --dump-raw-trace Dump raw trace in ASCII. -m, --modules Load module symbols. WARNING: use only with -k and LIVE kernel -d, --dsos= Only consider symbols in these dsos. CSV that understands file://filename entries. -C, --comms= Only consider symbols in these comms. CSV that understands file://filename entries. -S, --symbols= Only consider these symbols. CSV that understands file://filename entries. -s, --sort= Sort by key(s): pid, comm, dso, symbol. -t, --field-separator= Use a special separator character and don't pad with spaces, replacing all occurrences of this separator in symbol names (and other output) with a . character, that thus it's the only non valid separator. -v, --verbose Be verbose, for instance, show the raw counts in addition to the diff. -f, --force Don't complain, do it. --symfs=<directory> Look for files with symbols relative to this directory. -b, --baseline-only Show only items with match in baseline. -c, --compute Differential computation selection - delta,ratio,wdiff (default is delta). See COMPARISON METHODS section for more info. -p, --period Show period values for both compared hist entries. -F, --formula Show formula for given computation. -o, --order Specify compute sorting column number. COMPARISON
The comparison is governed by the baseline file. The baseline perf.data file is iterated for samples. All other perf.data files specified on the command line are searched for the baseline sample pair. If the pair is found, specified computation is made and result is displayed. All samples from non-baseline perf.data files, that do not match any baseline entry, are displayed with empty space within baseline column and possible computation results (delta) in their related column. Example files samples: - file A with samples f1, f2, f3, f4, f6 - file B with samples f2, f4, f5 - file C with samples f1, f2, f5 Example output: x - computation takes place for pair b - baseline sample percentage o perf diff A B C baseline/A compute/B compute/C samples --------------------------------------- b x f1 b x x f2 b f3 b x f4 b f6 x x f5 o perf diff B A C baseline/B compute/A compute/C samples --------------------------------------- b x x f2 b x f4 b x f5 x x f1 x f3 x f6 o perf diff C B A baseline/C compute/B compute/A samples --------------------------------------- b x f1 b x x f2 b x f5 x f3 x x f4 x f6 COMPARISON METHODS
delta If specified the Delta column is displayed with value d computed as: d = A->period_percent - B->period_percent with: - A/B being matching hist entry from data/baseline file specified (or perf.data/perf.data.old) respectively. o period_percent being the % of the hist entry period value within single data file ratio If specified the Ratio column is displayed with value r computed as: r = A->period / B->period with: - A/B being matching hist entry from data/baseline file specified (or perf.data/perf.data.old) respectively. o period being the hist entry period value wdiff:WEIGHT-B,WEIGHT-A If specified the Weighted diff column is displayed with value d computed as: d = B->period * WEIGHT-A - A->period * WEIGHT-B o A/B being matching hist entry from data/baseline file specified (or perf.data/perf.data.old) respectively. o period being the hist entry period value o WEIGHT-A/WEIGHT-B being user suplied weights in the the -c option behind : separator like -c wdiff:1,2. o WIEGHT-A being the weight of the data file o WIEGHT-B being the weight of the baseline data file SEE ALSO
perf-record(1) perf 06/30/2014 PERF-DIFF(1)
All times are GMT -4. The time now is 01:28 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy