Sponsored Content
Top Forums UNIX for Dummies Questions & Answers [Help]Shellscript -Userinput string replacement with .... Post 302424067 by Scrutinizer on Monday 24th of May 2010 05:56:34 AM
Old 05-24-2010
Try this:
Code:
read inp
inp2="${inp%?}"
echo "${inp#${inp%?}}${inp2#?}${inp%${inp#?}}"

Code:
dorlw


Last edited by Scrutinizer; 05-24-2010 at 07:12 AM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

sed problem - replacement string should be same length as matching string.

Hi guys, I hope you can help me with my problem. I have a text file that contains lines like this: 78 ANGELO -809.05 79 ANGELO2 -5,000.06 I need to find all occurences of amounts that are negative and replace them with x's 78 ANGELO xxxxxxx 79... (4 Replies)
Discussion started by: amangeles
4 Replies

2. Shell Programming and Scripting

Replace userinput with forward sladh (/)

Hi All, If I wanted to find and replace a line with a user input value that has forward slash, then how to do it? For example I have a script called ./configure.sh which will ask for user to input some path (let's say WPS_HOME). I can read that user input and want to put this value to a... (6 Replies)
Discussion started by: rijeshpp
6 Replies

3. Shell Programming and Scripting

Replacement of string

Hi I have a text file which contains the following. AAA,BBB,CCC,DDD AAA,BBB,CCC,DDD AAA,BBB,CCC,DDD How can I replace all CCC with 888, with other contents inside the file remain unchange? Please advice Desired output: AAA,BBB,888,DDD AAA,BBB,888,DDD AAA,BBB,888,DDD (1 Reply)
Discussion started by: c0384
1 Replies

4. Shell Programming and Scripting

String replacement

Hi I am new to shell scripting but i manage to do some simple things. I am trying to replace a string in one file. I am using sed to replace but it is not permanently writing to the file, rather it is temporary. I want to know whether is there any another method to replace a string in a file... (7 Replies)
Discussion started by: reddybs
7 Replies

5. Shell Programming and Scripting

String replacement

I have one string string1=user/password:IP_ADDR:Directory I need to replace string1 value like store into string2 string2=user password:IP_ADDR:Directory i.e replace "/" character by '<space>' character But i wouldn't use any file in the meantime. Please help me......................... (6 Replies)
Discussion started by: mnmonu
6 Replies

6. Shell Programming and Scripting

String replacement

Hi All, I have below file which has data in below format. #$ | AB_100 | AB_300 ()| AB_4 @*(% | AB-789 i want o/p as below format. | AB_100 | AB_300 | AB_4 | AB-789 So here there is no standard format. How we can achieve the same in unix ? Regards, (3 Replies)
Discussion started by: gander_ss
3 Replies

7. Shell Programming and Scripting

remove newline between two string with sed command in unix shellscript

I have a file (test.dat) which contains data like this 459|199811047|a |b |shan kar|ooty| 460|199811047|a |bv |gur u|cbe| but I need it like: 459|199811047|a |b |shankar|ooty| 460|199811047|a |b |guru|cbe| While reading the data from this file, I don't want to remove newline from the end of... (4 Replies)
Discussion started by: jcrshankar
4 Replies

8. Shell Programming and Scripting

String replacement.

Dear Friends, I want to replace following line with given line. It should grep/search following string in a file (input.txt) M/M SRNO: 000M/6200-0362498 COSMETIC PRO MALE FEMALE Once found it should replace it to following string. T_DLHNNO: 000M/6200-0362498 ... (7 Replies)
Discussion started by: anushree.a
7 Replies

9. Shell Programming and Scripting

String replacement

Hi, I have a text file where all records come in one line (single line file), each record starts with 'BUCH' and ends with '@&' and if data is not there we get space instead. between '@&' and next record there might be some spaces, now I want to remove those spaces between '@&' and 'BUCH'. ... (4 Replies)
Discussion started by: maks475
4 Replies

10. Shell Programming and Scripting

Shellscript command to remove files starting with a certain string, and older than 3 days

Hi All, Need help in identifying a shellscript command to remove all files on a server directory, starting with a certain prefix and also older than 3 days. That means files created with that prefix, today or yesterday, shouldn't be removed. Thanks, Dev (3 Replies)
Discussion started by: dev.devil.1983
3 Replies
giiQueryDeviceInfo(3)							GGI						     giiQueryDeviceInfo(3)

NAME
giiQueryDeviceInfo, giiQueryDeviceInfoByNumber - Get information about input sources SYNOPSIS
#include <ggi/gii.h>` int giiQueryDeviceInfo (gii_input_t inp, uint32_t origin, gii_cmddata_getdevinfo *info); int giiQueryDeviceInfoByNumber(gii_input_t inp, uint32_t number, uint32_t *origin, gii_cmddata_getdevinfo *info); DESCRIPTION
Though when using GII inputs the exact type of device is fully transparent to the program, information about the device that is actually attached to a given gii input and origin id can be queried, e.g. for configuration interfaces. For giiQueryDeviceInfo the parameters inp and origin select the input to query. This version is usually used, if you want to identify a device after getting an event from it. For giiQueryDeviceInfoByNumber the parameters inp and number select the input to query - origin gets set to the origin ID the queried device has. This version is used, when you want to query all known devices. The queried data is put into info. See gii_cmddata_getdevinfo(3) for the description of the structure. RETURN VALUE
Returns 0 on success (info is valid, then) or -1 otherwise. SEE ALSO
giiQueryValInfo(3) libgii-1.0.x 2006-12-30 giiQueryDeviceInfo(3)
All times are GMT -4. The time now is 05:07 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy