Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Extracting the last 3 chars from a string using sed Post 43993 by Perderabo on Wednesday 26th of November 2003 02:16:33 PM
Old 11-26-2003
Your command looks for 3 explicit dots at the end of a line, if they exist, the line is printed. But you did not use -n, so the line gets printed anyway.

You want this:
sed 's/.*\(...\)$/\1/'
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

sed, grep, awk, regex -- extracting a matched substring from a file/string

Ok, I'm stumped and can't seem to find relevant info. (I'm not even sure, I might have asked something similar before.): I'm trying to use shell scripting/UNIX commands to extract URLs from a fairly large web page, with a view to ultimately wrapping this in PHP with exec() and including the... (2 Replies)
Discussion started by: ropers
2 Replies

2. Shell Programming and Scripting

Retreive string between two chars

I want to write a shell script in order to retreive some data from a log file that i have written into. The string that i want to get is the number 2849 (that is located between | | ). To explain further, this is the result i get after running "grep LOGIN filename.log" but i need to get the... (25 Replies)
Discussion started by: danland
25 Replies

3. UNIX for Dummies Questions & Answers

Using SED to get n chars after given value from file

Hello, my name is Marc, I'm a linux starter :) 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... (12 Replies)
Discussion started by: Kally
12 Replies

4. Shell Programming and Scripting

Matching 2 chars of a string that repeat

Hello Unix gurus, I have a gzipped file where each line contains 2 street addresses in the US. What I want to do is get a count for each state that does not match. What I have so far is: $ gzcat matched_10_09.txt.gz |cut -c 106-107,184-185 | head -5 CTCT CTNY CTCT CTFL CTMA This cuts... (5 Replies)
Discussion started by: sitney
5 Replies

5. Shell Programming and Scripting

Repeatable chars in a string

I have a string I keep appending too upto certain amount of chars. Is there some sort of way for me to check the string to see if I hit my limit of repeatable characters? For example, assume I allow for 2 repeatable chars, this will be a valid string Xxh03dhJUX, so I can append the last... (3 Replies)
Discussion started by: BeefStu
3 Replies

6. Shell Programming and Scripting

[Solved] print chars of a string

how can i print all the chars of a string one by line? i have thought that use a for cicle and use this command inside: ${VARIABLE:0:last}but how can i make last? because string is random P.S. VARIABLE is the string or can i make a variable for every chars of this string? this was my idea... (10 Replies)
Discussion started by: tafazzi87
10 Replies

7. 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

8. UNIX for Dummies Questions & Answers

How to search for a string with special chars?

Hi guys, I am trying to find the following string in a file, but I always get pattern not found error, not sure what is missing here. Can you help please? I do a less to open the xrates.log and then do a /'="18"' in the file and tried various combinations to search the below string. String... (8 Replies)
Discussion started by: santokal
8 Replies

9. Shell Programming and Scripting

Add an string at every x chars

Hi All, I have a file fo around 15k bytes which i need to insert a string " + "at every 250 bytes. I found some ideas here using perl to split into lines and tried to addapt it but the results where not satisfactory for instance i tried to change #!/usr/bin/perl $teststring =... (9 Replies)
Discussion started by: kadu
9 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
SCONSIGN(1)						      General Commands Manual						       SCONSIGN(1)

NAME
sconsign - print SCons .sconsign file information SYNOPSIS
sconsign [ options... ] file [ ... ] DESCRIPTION
The sconsign command displays the contents of one or more .sconsign files specified by the user. By default, sconsign dumps the entire contents of the specified file(s). Each entry is printed in the following format: file: signature timestamp length implicit_dependency_1: signature timestamp length implicit_dependency_2: signature timestamp length action_signature [action string] None is printed in place of any missing timestamp, bsig, or csig values for any entry or any of its dependencies. If the entry has no implicit dependencies, or no build action, the lines are simply omitted. By default, sconsign assumes that any file arguments that end with a .dbm suffix contains signature entries for more than one directory (that is, was specified by the SConsignFile () function). Any file argument that does not end in .dbm is assumed to be a traditional .sconsign file containing the signature entries for a single directory. An explicit format may be specified using the -f or --file= options. OPTIONS
Various options control what information is printed and the format: -a, --act, --action Prints the build action information for all entries or the specified entries. -c, --csig Prints the content signature (csig) information for all entries or the specified entries. -d DIRECTORY, --dir=DIRECTORY When the signatures are being read from a .dbm file, or the -f dbm or --format=dbm options are used, prints information about only the signatures for entries in the specified DIRECTORY. -e ENTRY, --entry=ENTRY Prints information about only the specified ENTRY. Multiple -e options may be used, in which case information about each ENTRY is printed in the order in which the options are specified on the command line. -f FORMAT, --format=FORMAT The file(s) to be printed are in the specified FORMAT. Legal values are dbm (the DBM format used when the SConsignFile() function is used) or sconsign (the default format used for an individual .sconsign file in each directory). -h, --help Prints a help message and exits. -i, --implicit Prints the list of cached implicit dependencies for all entries or the the specified entries. --raw Prints a pretty-printed representation of the raw Python dictionary that holds build information about individual entry (both the entry itself or its implicit dependencies). An entry's build action is still printed in its usual format. -r, --readable Prints timestamps in a human-readable string, enclosed in single quotes. -t, --timestamp Prints the timestamp information for all entries or the specified entries. -v, --verbose Prints labels identifying each field being printed. ENVIRONMENT
SCONS_LIB_DIR Specifies the directory that contains the SCons Python module directory (e.g. /home/aroach/scons-src-0.01/src/engine). on the com- mand line. SEE ALSO
scons, scons User Manual, scons Design Document, scons source code. AUTHORS
Steven Knight <knight at baldmt dot com> September 2011 SCONSIGN(1)
All times are GMT -4. The time now is 09:10 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy