Sponsored Content
Top Forums Shell Programming and Scripting Prefix a string to the contents of a file Post 302255684 by aajan on Friday 7th of November 2008 12:20:06 AM
Old 11-07-2008
U can try this also!!!!!!!!!!!


awk '{print("###|",$0)}' filename > newfile

Cheers
 

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

Replacing string in all instances (both filenames and file contents) in a directory

Hi, I have a set of files stored in a single directory that I use to set parameters for a physics code, and I would like to streamline the process of updating them all when I change a parameter. For instance, if the files are called A2000p300ini, A2000p300sub, A2000p300run, and the text in each... (3 Replies)
Discussion started by: BlueChris
3 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

Help in searching a particular string in a file name (not inside the file contents)

Dear Unix Gurus, I am new to shell scripting and in the process of learing. I am trying to find whether a file name has today's date in MMDDYYYY format. I am using the following code and it doesn't seem like working. #!/usr/bin/ksh today=$(date '+%m%d%Y') echo today: $today file=`find... (4 Replies)
Discussion started by: shankar1dada
4 Replies

5. UNIX for Dummies Questions & Answers

Replacing a particular string in all files in folder and file contents

I need to replace all filesnames in a folder as well as its content from AK6 to AK11. Eg Folder has files AK6-Create.xml, AK6-system.py etc.. the files names as well as contents should be changes to AK9-Create.xml, AK9-system.py etc All files are xml and python scripts. ---------- Post... (0 Replies)
Discussion started by: Candid247
0 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

sed - Replace string with file contents

Hello, I have two files: file1 and file2 file1 has the following info: --- host: "localhost" port: 3000 reporter_type: "zookeeper" zk_hosts: - "localhost:2181" file2 contains an IP address (1.1.1.1) What I want to do is replace localhost with 1.1.1.1, so that the... (4 Replies)
Discussion started by: Jay Kah
4 Replies

8. Shell Programming and Scripting

How to insert file contents after nth occurrence of a string using sed?

Hi, I would like to know how, using sed, be able to insert contents of file2 in file1 after say the second occurrence of a given string? e.g. > cat file1 banana apple orange apple banana pear tangerine apple > cat file2 I don't like apples What would be the sed command to insert... (5 Replies)
Discussion started by: dimocn
5 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

Sed: how to use file contents in replacement string

I want to replace a string by contents of file. I am trying the following sed command: cat sample | sed "s^<enter description here>^`cat details`^" But it is not working. a=`cat details` and using $a will not help since it will affect the whitespaces. What am I missing in the above sed... (5 Replies)
Discussion started by: anand_bh
5 Replies
XmImMbLookupString(library call)										  XmImMbLookupString(library call)

NAME
XmImMbLookupString -- An input manager function that retrieves a composed string from an input method SYNOPSIS
#include <Xm/XmIm.h> int XmImMbLookupString( Widget widget, XKeyPressedEvent *event, char *buffer_return, int bytes_buffer, KeySym *keysym_return, int *status_return); DESCRIPTION
XmImMbLookupString returns a string composed in the locale associated with the widget's input method and a KeySym that is currently mapped to the keycode in a KeyPress event. The KeySym is obtained by using the standard interpretation of Shift, Lock and Group modifiers as defined in the X Protocol specification. An XIM will be created, but an XIC will not be created. One of the functions, XmImSetValues, XmImVaSetValues, or XmImGetXIC, needs to be called to create an XIC. widget Specifies the ID of the widget registered with the input manager event Specifies the key press event buffer_return Specifies the buffer in which the string is returned bytes_buffer Specifies the size of the buffer in bytes keysym_return Specifies a pointer to the KeySym returned if one exists status_return Specifies the status values returned by the function. These status values are the same as those for the XmbLookupString function. The possible status values are: XBufferOverflow The size of the buffer was insufficient to handle the returned string. The contents of buffer_return and keysym_return are not modified. The required buffer size is returned as a value of the function. The client should repeat the call with a larger buffer size to receive the string. XLookupNone No consistent input was composed. The contents of buffer_return and keysym_return are not modified and the function returns a value of 0. XLookupChars Some input characters were composed and returned in buffer_return. The content of keysym_return is not modified. The function returns the length of the string in bytes. XLookupKeysym A keysym value was returned instead of a string. The content of buffer_return is not modified and the function returns a value of 0. XLookupBoth A keysym value and a string were returned. The keysym value may not necessarily correspond to the string returned. The function returns the length of the string in bytes. RETURN
Return values depend on the status returned by the function. Refer to the description of status values above. RELATED
XmImGetXIM(3), XmImGetXIC(3), XmImRegister(3), XmImSetValues(3), and XmImUnregister(3). XmImMbLookupString(library call)
All times are GMT -4. The time now is 03:27 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy