Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Replace string with modifying original file Post 302672391 by alister on Monday 16th of July 2012 10:06:03 AM
Old 07-16-2012
I don't know csh, so I'll leave the looping to you, but here's an approach that edits the files in place.
Code:
printf '%s\n' '1,$s/[[:digit:]]*\./555./' w q | ed -s filename

It looks for the first dot in the record and replaces any digits that precede it (if any).

Regards,
Alister
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How To Replace A String In File With A String Containing Windows File Path

Hi, I have a file with the following contents # Lines that start with a # are comments. # # Calling TOAD like this will perform a comparison from command line : # # "C:\Program Files\Quest Software\Toad for Oracle 9.6\toad.exe" -c... (2 Replies)
Discussion started by: rajan_san
2 Replies

2. Shell Programming and Scripting

Using sed to replace a string in file with a string in a variable that contains spaces

Hi, i call my shell like: my_shell "my project name" my script: #!/bin/bash -vx projectname=$1 sed s/'PROJECT_NAME ='/'PROJECT_NAME = '$projectname/ <test_config_doxy >temp cp temp test_config_doxy the following error occurres: sed s/'PROJECT_NAME ... (2 Replies)
Discussion started by: vivelafete
2 Replies

3. Shell Programming and Scripting

replace (sed?) a single line/string in file with multiple lines (string) from another file??

Can someone tell me how I can do this? e.g: Say file1.txt contains: today is monday the 22 of NOVEMBER 2010 and file2.txt contains: the 11th month of How do i replace the word NOVEMBER with (5 Replies)
Discussion started by: tuathan
5 Replies

4. UNIX for Dummies Questions & Answers

Search a string in the file and then replace another string after that position

Hi I am looking for a particular string in a file.If the string exists, then I want to replace another string with some other text.Once replaced, search for the same text after that character position in the file. :wall: E.g: Actual File content: Hello Name: Nitin Raj Welcome to Unix... (4 Replies)
Discussion started by: dashing201
4 Replies

5. Shell Programming and Scripting

replace (sed?) a string in file with multiple lines (string) from variable

Can someone tell me how I can do this? e.g: a=$(echo -e wert trewt ertert ertert ertert erttert erterte rterter tertertert ert) How do i replace the STRING with $a? I try this: sed -i 's/STRING/'"$a"'/g' filename.ext but this don' t work (2 Replies)
Discussion started by: jforce
2 Replies

6. Shell Programming and Scripting

perl script to replace the text in the original file

Hi Folks, I have an html file which contains the below line in the body tagI am trying the replace hello with Hello Giridhar programatically. <body> <P><STRONG><FONT face="comic sans ms,cursive,sans-serif"><EM>Hello</EM></FONT></STRONG></P> </body> I have written the below code to... (3 Replies)
Discussion started by: giridhar276
3 Replies

7. UNIX for Dummies Questions & Answers

Search for a string,delete the line and replace with new string in a file

Hi Everyone, I have a requirement in ksh where i have a set of files in a directory. I need to search each and every file if a particular string is present in the file, delete that line and replace that line with another string expression in the same file. I am very new to unix. Kindly help... (10 Replies)
Discussion started by: Pradhikshan
10 Replies

8. Shell Programming and Scripting

Replace string in XML file with awk/sed with string from another

Sorry for the long/weird title but I'm stuck on a problem I have. I have this XML file: </member> <member> <name>TransactionID</name> <value><string>123456789123456</string></value> </member> <member> <name>Number</name> ... (9 Replies)
Discussion started by: cozzin
9 Replies

9. Shell Programming and Scripting

Replace string of a file with a string of another file for matches using grep,sed,awk

I have a file comp.pkglist which mention package version and release . In 'version change' and 'release change' line there are two versions 'old' and 'new' Version Change: --> Release Change: --> cat comp.pkglist Package list: nss-util-devel-3.28.4-1.el6_9.x86_64 Version Change: 3.28.4 -->... (1 Reply)
Discussion started by: Paras Pandey
1 Replies

10. UNIX for Beginners Questions & Answers

Search partial string in a file and replace the string - UNIX

I have the below string which i need to compare with a file and replace this string in the file which matches closely. Can anyone help me on this. string(Scenario 1)- user::r--,user::ourfrd:r-- String(Scenario 2)- user::r-- File **** # file: /local/Desktop/myfile # owner: me # group:... (6 Replies)
Discussion started by: sarathy_a35
6 Replies
Dialcodes(4)						     Kernel Interfaces Manual						      Dialcodes(4)

NAME
Dialcodes - Contains the initial digits of telephone numbers used to establish remote connections over a telephone line SYNOPSIS
/usr/lib/uucp/Dialcodes DESCRIPTION
The /usr/lib/uucp/Dialcodes file contains the initial digits of telephone numbers used by the uucp program to establish remote connections over a telephone line. The Dialcodes file simplifies entries in the /usr/lib/uucp/Systems file for sites where a number of device tele- phone numbers have the same prefix. If users at your site communicate regularly by way of telephone lines and modems to multiple systems all located at the same remote site, or to multiple systems located at different remote sites, use dial-code abbreviations in the /usr/lib/uucp/Systems file rather than entering the complete telephone number of each remote modem in that file. The Dialcodes file contains dial-code abbreviations and partial telephone numbers that complete the telephone entries in the /usr/lib/uucp/Systems file. Entries in the Dialcodes file contain an alphabetic prefix attached to a partial telephone number that may include the following information, in the order listed: Codes for an outside line. Long-distance access codes (1 and the area code, if the modem is out of the local area). The 3-digit exchange number. The relevant alphabetic prefix (representing the partial telephone number), together with the remaining four digits of that number, is then entered in the Phone field in the /usr/lib/uucp/Systems file. Following is the form of an entry in a Dialcodes file: DialCodeAbbreviation DialingSequence The DialCodeAbbreviation part of the entry is an alphabetic prefix containing up to eight letters, established when setting up the dial- code listing. The DialingSequence comprises all the digits in the number that precede the actual 4-digit telephone number. Note that if your site uses only a relatively small number of telephone connections to remote systems, include the complete telephone num- bers of the remote modems in the /usr/lib/uucp/Systems file rather than using dial-code abbreviations. Enter each prefix only once in the Dialcodes file. When you have set up a dial-code abbreviation, use that prefix in all relevant entries in the /usr/lib/uucp/Systems file. Only someone with superuser authority can edit the Dialcodes file, which is owned by the uucp program login ID. EXAMPLES
The Dialcodes file on system venus contains the following dial-code prefix for use with a number in the /usr/lib/uucp/Systems file: local 9=555 The Systems file on system venus contains the following entry for system zeus, including a telephone number and a dial-code prefix: zeus Any ACU 1200 local1212 in:--in: nuucp word: thunder When the uucp program on system venus dials system zeus, it uses the expanded telephone number =5551212. FILES
Contains all the configuration files for the uucp program, including the Dialcoddes file Contains information about available devices Spec- ifies initial handshaking on a connection Describes accessible remote systems RELATED INFORMATION
Commands: cu(1), tip(1), uucp(1), uuto(1), uux(1) delim off Dialcodes(4)
All times are GMT -4. The time now is 04:28 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy