Sponsored Content
Top Forums UNIX for Dummies Questions & Answers how to cut prefix from a string Post 302286804 by ce9888 on Thursday 12th of February 2009 01:53:31 AM
Old 02-12-2009
Try this :'

Code:
cat yourfile | cut -d":"  -f2

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to cut prefix from a string?

Hi folks, I have the following parameter setting: export ADMIN_HOST_NAME=http://hostname.com I want to define a new parameter,ADMIN_HOST_NAME_NEW,which based on $ADMIN_HOST_NAME but I need to remove the prefix "http://". The requested result for $ADMIN_HOST_NAME_NEW is hostname.com How... (2 Replies)
Discussion started by: nir_s
2 Replies

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

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

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
mktemp(1)						      General Commands Manual							 mktemp(1)

Name
       mktemp - make a name for a temporary file

Syntax
       mktemp [ -c ] [ -d directory_name ] [ -p prefix ]

Description
       The  command makes a name for the pathname of a temporary file and writes that name to standard output. The name will not duplicate that of
       an existing file. The command does not create a new file. The file named must actually be created before can generate a new filename.

       Subsequent calls to will only generate a new file name if all previously generated file names have been	created  by  the  user	and  still
       exist.  Error messages are written to standard error.

       The  directory_name generated by is the concatenation of a directory name, a slash (/), a file prefix, a dot (.), a four digit number and a
       unique character.

       The directory name is chosen as follows:

	  (1)  If the -d option is specified, directory_name is used.

	  (2)  Otherwise, if the TMPDIR environment variable is set and a string that would yield a unique name can be obtained using the value of
	       that variable as a directory name, this value is used.

	  (3)  Otherwise, is used.

       The prefix is chosen as follows:

	  (1)  If the -p option is specified, prefix is used.

	  (2)  Otherwise, if the LOGNAME environment variable is set, it is used as the prefix.

	  (3)  Otherwise, the user's login name is used.

Options
       -c	   Causes to attempt to create a regular file using the generated (or created) name string. If file creation is successful, a zero
		   length file is created with access permissions derived from the process's file mode creation mask, see No attempt  is  made	to
		   create  a file if the length of the generated (or created) name string exceeds 1023 characters. It is the user's responsibility
		   to remove files created by use of this option.

       -d directory_name
		   Causes directory_name to be used as the directory portion of the pathname. In this case,  directory_name  is  used  instead	of
		   TMPDIR and

       -p prefix   Causes  the string prefix to be used as the file's prefix.  It is used instead of LOGNAM and the user's login name. If the pre-
		   fix is longer the 249 characters, it will be silently truncated to that length before the concatenation of the suffix.

Environmental Variables
       LOGNAME	   When the -p prefix option is not specified, the value of this variable is used as the prefix of the filename, if it exists.

       TMPDIR	   When the -d directory_name option is not specified, the value of this variable is used instead of

Restrictions
       If the user does not have write permission in the directory specified, and error message is reported and is used in its place.  The  entire
       path name can not exceed 1023 characters, and the temporary file name can not exceed 255 characters. If the generated file name is too long
       it is truncated to fit before the suffix is added.

See Also
																	 mktemp(1)
All times are GMT -4. The time now is 04:30 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy