Sponsored Content
Full Discussion: Replacing Text in Text file
Top Forums Shell Programming and Scripting Replacing Text in Text file Post 302210282 by cgilchrist on Monday 30th of June 2008 03:00:17 PM
Old 06-30-2008
Replacing Text in Text file

Hi Guys,

I am needing some help writing a shell script to replace the following in a text file

/opt/was/apps/was61

with some other path eg

/usr/blan/blah/blah.

I know that i can do it using sed or perl but just having difficulty writing the escape characters for it

All Help appreciated

Regards,
Chris
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

replacing strings with text from other file

Hi, Im trying to update some properties files with text from another file: file1 user=xyz file2 user= after script file2 user=xyz Im using this reading the $QUARTZURL,ETC... from quartz.properties: echo... (1 Reply)
Discussion started by: mc1392
1 Replies

2. Shell Programming and Scripting

replacing text in a file, but...

Hi all, Very first post on this forums, hope you can help me with this scripting task. I have a big text file with over 3000 lines, some of those lines contain some text that I need to replace, lets say for simplicity the text to be replaced in those lines is "aaa" and I need it to replace it... (2 Replies)
Discussion started by: Angelseph
2 Replies

3. Shell Programming and Scripting

replacing text with contents from another file

I'm trying to change the ramfs size in kernel .config automatically. I have a ramfs_size file generated with du -s cat ramfs_size 64512 I want to replace the linux .config's ramdisk size with the above value CONFIG_BLK_DEV_RAM_SIZE=73728 Right now I'm doing something dumb like: ... (3 Replies)
Discussion started by: amoeba
3 Replies

4. Shell Programming and Scripting

Replacing text in a .csv file using Perl

I have played with this for some time but i dont seem like i am getting it right. I am trying to change the delimiters on a file so i can import it into a database. this file has rows of data separated by enter Right now the delimiters are represented by tabs and " ". e.g. "dlfkldfs... (9 Replies)
Discussion started by: salemh
9 Replies

5. UNIX for Dummies Questions & Answers

Help parsing and replacing text with file name

Hi everyone, I'm having trouble figuring this one out. I have ~100 *.fa files with multiple lines of fasta sequences like this: file1.fa >xyzsequence atcatgcacac...... ataccgagagg..... atataccagag..... >abcsequence atgagatatat..... acacacggd..... atcgaacac.... agttccagat.... The... (2 Replies)
Discussion started by: mycoguy
2 Replies

6. UNIX for Dummies Questions & Answers

Replacing a column in a text file

Say I had a text file that contained four columns, like the following: Mack Christopher:237 Avondale Blvd:970-791-6419:S Ben Macdonor:30 Dragon Rd:647-288-6395:B I'm making a loop that will replace the fourth column a line in the file with the contents of a variable 'access', but I have no... (6 Replies)
Discussion started by: Sotau
6 Replies

7. Shell Programming and Scripting

Replacing in huge text file

I have huge text files (~120 MB)x100 which equivalents to ~11GB of data. The files contain pure numbers, actually the value of "phi" to 10 billion digits!! I know its huge!! Here are the last few lines of a file 0952899155 3233967444 3344925499 0276061529 7261968933 9683989044 3317145063... (14 Replies)
Discussion started by: shantanuthatte
14 Replies

8. UNIX for Dummies Questions & Answers

Replacing all cells that have a specific value in a text file

I have a space delimited text file where I want to replace all cells that are 0 with NA. However I cannot simply use 'sed/0/NA/g' because there are other 0's in the text file that are part of numbers. Example input: 896.933464285715 0 874.691732142857 866.404660714286 Output:... (1 Reply)
Discussion started by: evelibertine
1 Replies

9. Programming

Replacing a word of a text file, in C++ fstream

How to replace a word in text file using c++ fstream. Is there a way, without creating any temporary file. Could you please share pseudo code ??? (1 Reply)
Discussion started by: techmonk
1 Replies

10. Shell Programming and Scripting

Match text to lines in a file, iterate backwards until text or text substring matches, print to file

hi all, trying this using shell/bash with sed/awk/grep I have two files, one containing one column, the other containing multiple columns (comma delimited). file1.txt abc12345 def12345 ghi54321 ... file2.txt abc1,text1,texta abc,text2,textb def123,text3,textc gh,text4,textd... (6 Replies)
Discussion started by: shogun1970
6 Replies
MKDIR(2)						      BSD System Calls Manual							  MKDIR(2)

NAME
mkdir -- make a directory file SYNOPSIS
#include <sys/stat.h> int mkdir(const char *path, mode_t mode); DESCRIPTION
The directory path is created with the access permissions specified by mode and restricted by the umask(2) of the calling process. See chmod(2) for the possible permission bit masks for mode. The directory's owner ID is set to the process's effective user ID. The directory's group ID is set to that of the parent directory in which it is created. Note: the behavior of mkdir() is undefined when mode bits other than the low 9 bits are used. Use chmod(2) after mkdir() to explicitly set the other bits (See example below). RETURN VALUES
A 0 return value indicates success. A -1 return value indicates an error, and an error code is stored in errno. ERRORS
Mkdir() will fail and no directory will be created if: [EACCES] Search permission is denied for a component of the path prefix. [EACCES] Write permission is denied for the parent directory. [EDQUOT] The new directory cannot be created because the user's quota of disk blocks on the file system that will contain the directory has been exhausted. [EDQUOT] The user's quota of inodes on the file system on which the directory is being created has been exhausted. [EEXIST] The named file exists. [EFAULT] Path points outside the process's allocated address space. [EIO] An I/O error occurred while making the directory entry or allocating the inode. [EIO] An I/O error occurred while reading from or writing to the file system. [ELOOP] Too many symbolic links were encountered in translating the pathname. This is taken to be indicative of a looping sym- bolic link. [EMLINK] The parent directory already has {LINK_MAX} links. [ENAMETOOLONG] A component of a pathname exceeded {NAME_MAX} characters, or an entire path name exceeded {PATH_MAX} characters. [ENOENT] A component of the path prefix does not exist or path is an empty string. [ENOSPC] The new directory cannot be created because there is no space left on the file system that would contain it. [ENOSPC] There are no free inodes on the file system on which the directory is being created. [ENOTDIR] A component of the path prefix is not a directory. [EROFS] The parent directory resides on a read-only file system. EXAMPLE
int main (int argc, const char * argv[]) { /* The behavior of mkdir is undefined for anything other than the "permission" bits */ if (mkdir("/tmp/blah", 0777)) perror("/tmp/blah"); /* So we need to set the sticky/executable bits explicitly with chmod after calling mkdir */ if (chmod("/tmp/blah", 07777)) perror("/tmp/blah"); } LEGACY SYNOPSIS
#include <sys/types.h> #include <sys/stat.h> The include file <sys/types.h> is necessary. SEE ALSO
chmod(2), stat(2), umask(2), compat(5) STANDARDS
The mkdir() function conforms to IEEE Std 1003.1-1988 (``POSIX.1''). 4.2 Berkeley Distribution December 11, 1993 4.2 Berkeley Distribution
All times are GMT -4. The time now is 02:27 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy