Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Using SED to get n chars after given value from file Post 302151732 by Kally on Monday 17th of December 2007 05:01:41 AM
Old 12-17-2007
Using SED to get n chars after given value from file

Hello, my name is Marc, I'm a linux starter Smilie and I hope you specialists can help me solving this issue.

I have a file containing a lot of data. Somewhere in this file, there's a string called "Faultdump", directly followed by 64 chars of HEX data. I need to get the HEX part. I accomplished this with several lines of code in a script calling sed, cut as well as head/tail. I know some of you guys will manage to get this on one line by using just awk or sed by avoiding cat or head/tail. Please can anyone of you point me to the right direction?

I was searching through the forums, but I'm afraid, I couldn't find an appropriate example.

Many thanks in advance!

Marc (Kally).
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Extracting the last 3 chars from a string using sed

Hi. Can I extract the last 3 characters from a given string using sed ? Why the following doesn't work (it prints the full string) : echo "abcd" | sed '/\.\.\.$/p' doesn't work ? output: abcd Thanks in advance, 435 Gavea. (7 Replies)
Discussion started by: 435 Gavea
7 Replies

2. Shell Programming and Scripting

Replace Junk chars (Sed)

I know this has been asked previously on this forum...But I think I have a different scenario to present. I ahve a file tht looks like this (note:there are control Z and other chars tht are not visible on line with anme bowers) BB7118450 6004718 BIANCALANA =HEI BZ5842819 ... (4 Replies)
Discussion started by: alfredo123
4 Replies

3. Shell Programming and Scripting

sed to extract first two uppercase chars in targeted lines

Hello, I have a file temp.txt: ------------------------- HELLO WORLD This is a temp file. TENCHARSHEre no beginning UPPERCHARS HI There ------------------------- What is a sed egrep command that will target lines that begin with 3-10 uppercase chars, and output the first 2 chars?... (5 Replies)
Discussion started by: str8danked
5 Replies

4. Shell Programming and Scripting

sed - how to insert chars into a line

Hi I'm new to sed, and need to add characters into a specific location of a file, the fileds are tab seperated. text <tab> <tab> text <tab> text EOL I need to add more characters to the line to look like this: text <tab> <tab> newtext <tab> text <tab> text EOL Any ideas? (2 Replies)
Discussion started by: tangentviper
2 Replies

5. Shell Programming and Scripting

Special chars in sed variable

Hi, For years ive been using this script to do mass search & replaces on our websites. Its worked with all sorts of spaces, quotes, html or whatever with a little adjusting here and there. But I just cant get this pattern to work: #!/bin/bash OLDURL="document.write('<script... (2 Replies)
Discussion started by: mutex
2 Replies

6. Shell Programming and Scripting

sed discard chars after last _

Hi, I'd get fields like unix_linux_form_yyyyddmmhhmi.file.txt shell_programming_and_scripting.txt so on... and want them as below unix_linux_form shell_programming_and I could remove everything after a '.' as below echo $field | sed 's/\..*//' but how to remove... (14 Replies)
Discussion started by: dips_ag
14 Replies

7. Shell Programming and Scripting

AWK/SED: handle max chars in a line

Hi all, I hope you guys can help me. I prefer SED/AWK solutions if possible. For my shame it didn't work for me :o ISSUE: :wall: 1\3 1/$4\@7\ 1234567890123456789\ 1234567890123456789,\ 1234567890123456789\ 123456789012 12345 1234567890123456789\ 1234567890123456789,\ 1234... (5 Replies)
Discussion started by: unknown7
5 Replies

8. Shell Programming and Scripting

Remove duplicate chars and sort string [SED]

Hi, INPUT: DCBADD OUTPUT: ABCD The SED script should alphabetically sort the chars in the string and remove the duplicate chars. (5 Replies)
Discussion started by: jds93
5 Replies

9. UNIX for Dummies Questions & Answers

Grep or sed to search, replace/insert chars!

HI All Im trying to come up with an approach to finding a string, using a portion of that string to insert it on lines starting with the value "GOTO" appending to end of line after removing PT's ( See example below! ) EXAMPLE: 1. I would like to search for the line that starts with "TLAXIS/"... (7 Replies)
Discussion started by: graymj
7 Replies

10. Shell Programming and Scripting

sed - print only the chars that match a given set in a string

For a given string that may contain any ASCII chars, i.e. that matches .*, find and print only the chars that are in a given subset. The string could also have numbers, uppercase, special chars such as ~!@#$%^&*(){}\", whatever a user could type in without going esoteric For simplicity take... (1 Reply)
Discussion started by: naderra
1 Replies
Gtk2::EntryBuffer(3pm)					User Contributed Perl Documentation				    Gtk2::EntryBuffer(3pm)

NAME
Gtk2::EntryBuffer - wrapper for GtkEntryBuffer HIERARCHY
Glib::Object +----Gtk2::EntryBuffer The Gtk2::EntryBuffer class contains the actual text displayed in a Gtk2::Entry widget. A single Gtk2::EntryBuffer object can be shared by multiple Gtk2::Entry widgets which will then share the same text content, but not the cursor position, visibility attributes, icon etc. Gtk2::EntryBuffer may be derived from. Such a derived class might allow text to be stored in an alternate location, such as non-pageable memory, useful in the case of important passwords. Or a derived class could integrate with an application's concept of undo/redo. METHODS
entrybuffer = Gtk2::EntryBuffer->new ($initial_chars=undef) o $initial_chars (string) unsigned = $buffer->get_bytes integer = $buffer->delete_text ($position=0, $n_chars=-1) o $position (integer) o $n_chars (integer) $buffer->emit_deleted_text ($position, $n_chars) o $position (integer) o $n_chars (integer) $buffer->emit_inserted_text ($position, $chars, $n_chars) o $position (integer) o $chars (string) o $n_chars (integer) $buffer->insert_text ($position, $chars) o $position (integer) o $chars (string) integer = $buffer->get_length integer = $buffer->get_max_length $buffer->set_max_length ($max_length) o $max_length (integer) string = $buffer->get_text $buffer->set_text ($chars) o $chars (string) PROPERTIES
'length' (Glib::UInt : default 0 : readable / private) Length of the text currently in the buffer 'max-length' (integer : default 0 : readable / writable / private) Maximum number of characters for this entry. Zero if no maximum 'text' (string : default "" : readable / writable / private) The contents of the buffer SIGNALS
inserted-text (Gtk2::EntryBuffer, Glib::UInt, string, Glib::UInt) deleted-text (Gtk2::EntryBuffer, Glib::UInt, Glib::UInt) SEE ALSO
Gtk2, Glib::Object COPYRIGHT
Copyright (C) 2003-2011 by the gtk2-perl team. This software is licensed under the LGPL. See Gtk2 for a full notice. perl v5.14.2 2012-05-27 Gtk2::EntryBuffer(3pm)
All times are GMT -4. The time now is 08:51 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy