Sponsored Content
Top Forums Shell Programming and Scripting How to cut prefix from a string? Post 99571 by vgersh99 on Sunday 19th of February 2006 02:53:28 PM
Old 02-19-2006
Code:
#!/bin/ksh

a='http://hostname.com'
b="${a##http://}"
echo "${b}"

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

read string, check string length and cut

Hello All, Plz help me with: I have a csv file with data separated by ',' and optionally enclosed by "". I want to check each of these values to see if they exceed the specified string length, and if they do I want to cut just that value to the max length allowed and keep the csv format as it... (9 Replies)
Discussion started by: ozzy80
9 Replies

2. Shell Programming and Scripting

Prefix a string to the contents of a file

Hi all, I have a requirement where in i have to create a temporary file by prefixing a string of special characters to each row of a input file. the input file is '|' delimited. here is the content of input file aaa|1234|axad|123 bbb|qwqw|qw|1334 the output should be ... (5 Replies)
Discussion started by: nvuradi
5 Replies

3. UNIX for Dummies Questions & Answers

how to cut prefix from a string

I have a file: chromosome1:436728 chromosome2:32892 ..... chromosome22:23781 I just want to get the number, not the prefix "chromosomeX", so I want to remove all the prefix ahead of the numbers. How can I do that?? Thanks!!! (PS: give me some very simple command so that I can understand... (4 Replies)
Discussion started by: kaixinsjtu
4 Replies

4. Shell Programming and Scripting

QUERY_STRING with multiples appearances of the same string prefix

I have a shell script and it works pretty well to pull out the query_string contents of a single instance of router= But if I have multiple router= strings, it only pulls out the last one. Is there a way to pull out every router= and if there is a multple string, to egrep them together... (1 Reply)
Discussion started by: numele
1 Replies

5. Shell Programming and Scripting

Replace prefix and suffix of a string

Hi, I'm new about shell scripting, and I need to do something like abcd **1234** efgh by abcd '''1234''' efgh I know that command sed helps about change one string by another, but I dont know how to keep whatever is inside **_** and replace * with '. Thanks! (5 Replies)
Discussion started by: selvaya
5 Replies

6. Shell Programming and Scripting

Using filename to determine a prefix that needs to be added to string column on file?

Possible filenames: CDD_Whatever.txt DDD_Whatever.txt If the file prefix = CDD, I'd like to prefix every person ID (second column in my examples below) on the file with "c-" If the file prefix = DDD, I'd like to prefix ever person ID with "d-" Input: Desired Output: Any help... (2 Replies)
Discussion started by: lrluis
2 Replies

7. Shell Programming and Scripting

Cut the string

Hi in a directory i've files having the following name for_category_info_19990101984301 for_catgry_meta_19991111214601 ------- I just want the name till year and month i.e; for_category_info_199901 for_catgry_meta_199911 How can i achieve the above string Thanks (2 Replies)
Discussion started by: smile689
2 Replies

8. Shell Programming and Scripting

Cut the string

---------- Post updated at 10:31 AM ---------- Previous update was at 10:28 AM ---------- Hello, I am trying to get the string cut based on the following needs: String1=Submitted request 25574824 for CONCURRENT SQLAP RUAPACTUALSEXT Y RUAPACTUALS122313100616.dat "2013/01/12 14:50:44"... (6 Replies)
Discussion started by: cartrider
6 Replies

9. Shell Programming and Scripting

Removing only Prefix string (!)

Hello everyone, I want to remove only prefix ME_ from all the values that are present in the FILEA. Below code I'm using for this. sed 's/ME\_//g' FILEA > FILEB Using the above code, all ME_ values are getting removed from the file. But the problem here is I want to remove only Prefix ME_... (4 Replies)
Discussion started by: ed_9
4 Replies

10. Shell Programming and Scripting

Extract Uniq prefix from a start and end prefix

Dear All, assume i have a file with content: <Start>6000</Start> <Stop>7599</Stop> the output is: 6000 7000 7100 7200 7300 7400 7599 how should we use any awk, sed, perl can do this task, means to extract the uniq prefixes from the start and stop prefix. Thanks Jimmy (3 Replies)
Discussion started by: jimmy_y
3 Replies
MACHINE-INFO(5) 						   machine-info 						   MACHINE-INFO(5)

NAME
machine-info - Local machine information file SYNOPSIS
/etc/machine-info DESCRIPTION
The /etc/machine-info file contains machine metadata. The basic file format of machine-info is a newline-separated list of environment-like shell-compatible variable assignments. It is possible to source the configuration from shell scripts, however, beyond mere variable assignments no shell features are supported, allowing applications to read the file without implementing a shell compatible execution engine. /etc/machine-info contains metadata about the machine that is set by the user or administrator. Depending on the operating system other configuration files might be checked for machine information as well, however only as fallback. You may use hostnamectl(1) to change the settings of this file from the command line. OPTIONS
The following machine metadata parameters may be set using /etc/machine-info: PRETTY_HOSTNAME= A pretty human-readable UTF-8 machine identifier string. This should contain a name like "Lennart's Laptop" which is useful to present to the user and does not suffer by the syntax limitations of internet domain names. If possible, the internet hostname as configured in /etc/hostname should be kept similar to this one. Example: if this value is "Lennart's Computer" an Internet hostname of "lennarts-computer" might be a good choice. If this parameter is not set, an application should fall back to the Internet host name for presentation purposes. ICON_NAME= An icon identifying this machine according to the XDG Icon Naming Specification[1]. If this parameter is not set, an application should fall back to "computer" or a similar icon name. CHASSIS= The chassis type. Currently, the following chassis types are defined: "desktop", "laptop", "convertible", "server", "tablet", "handset", "watch", and "embedded", as well as the special chassis types "vm" and "container" for virtualized systems that lack an immediate physical chassis. Note that many systems allow detection of the chassis type automatically (based on firmware information or suchlike). This setting (if set) shall take precedence over automatically detected information and is useful to override misdetected configuration or to manually configure the chassis type where automatic detection is not available. DEPLOYMENT= Describes the system deployment environment. One of the following is suggested: "development", "integration", "staging", "production". LOCATION= Describes the system location if applicable and known. Takes a human-friendly, free-form string. This may be as generic as "Berlin, Germany" or as specific as "Left Rack, 2nd Shelf". EXAMPLE
PRETTY_HOSTNAME="Lennart's Tablet" ICON_NAME=computer-tablet CHASSIS=tablet DEPLOYMENT=production SEE ALSO
systemd(1), os-release(5), hostname(5), machine-id(5), hostnamectl(1), systemd-hostnamed.service(8) NOTES
1. XDG Icon Naming Specification http://standards.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html systemd 237 MACHINE-INFO(5)
All times are GMT -4. The time now is 01:59 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy