Sponsored Content
Top Forums Shell Programming and Scripting sed with many special characters Post 302343800 by jim mcnamara on Thursday 13th of August 2009 04:05:22 PM
Old 08-13-2009
Your code is complicated. It looks like you a removing the embedded filename inside a file then writing it out, resulting in one large file.

try this
Code:
cat $( < source.txt) | grep -v -f source.txt > newbigfile

This won't work if the filenames in source.txt have spaces or odd characters.
If that is the case start with this
Code:
awk '{ printf("'%s'", $0) }' source.txt > src.txt
cat $( < source.txt) | grep -v -f src.txt > newbigfile

IF this doesn't work post the contents of source.txt
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

awk/sed with special characters

i have this script that searches for a pattern. However it fails if the pattern includes some special characters. So far, it fails with the following strings: 1. -Cr 2. $Mj 3. H'412 would a sed or awk be more effective? i don't want the users to put the (\) during the search (they... (5 Replies)
Discussion started by: apalex
5 Replies

2. Shell Programming and Scripting

Changing Special Characters Using Sed

Hi. Does anyone know how to use the sed command to change the special border characters on this .per file. I have to edit about 80 .per files. I need a sed script to change the below 3 and A characters. ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ³ Test Islands, Office of Public Health -- WIC... (4 Replies)
Discussion started by: cstovall
4 Replies

3. Shell Programming and Scripting

sed with special characters

Hi, I am reading a file (GC_JAR.log) which has entries like: 511725.629, 0.1122672 secs] 525268.975, 0.1240036 secs] 527181.835, 0.2068215 secs] 527914.287, 0.2884801 secs] 528457.134, 0.2548725 secs] I want to replace all the entries of "secs]" with just "secs" Thus, the output... (4 Replies)
Discussion started by: itzz.me
4 Replies

4. Shell Programming and Scripting

Using sed to replace special characters

Hi everyone I have file1 contains: '7832' ' 8765 6543 I want a sed command that will format as: '7832' , '8765' , '6543' I tried sed -e s/\'//g -e 's/^*//;s/*$//' file1 > file2 sed -e :a -e '$!N; s/\n/ /; ta' file2 which gives: 7832 8765 6543 I need some help to continue with... (5 Replies)
Discussion started by: nimo
5 Replies

5. Shell Programming and Scripting

SED with Special characters

Hello All Seeking the right one SED command. My attempt is: From orginal.txt by SED to target.txt sed -i "/('outbound-callerid/a\$ext->add($context, $exten, '', new ext_SipAddHeader('P-Preferred-Identity', '<sip:${CALLERID(nummer)}@carrier.com>'));" orginal.txtWhat am make wrong?:wall: ... (5 Replies)
Discussion started by: mdbinder
5 Replies

6. Shell Programming and Scripting

Escape special characters in SED

Need help in escaping special characters in sed command. Here is the the string which i am trying to find a replace with From :- REQUEST_TYPE=PIXEL&amp;MSG_ID={//MESSAGE_ID} To :- REQUEST_TYPE=PIXEL&amp;MSG_ID= X_EDELIVERY_MESSAGE_ID &amp; BATCH_ID= X_EDELIVERY_BATCH_ID Here is the sed command i am... (2 Replies)
Discussion started by: aakishore
2 Replies

7. Shell Programming and Scripting

sed special characters issue

Hi I'm trying to replace string1 by string2 in file homepage.htm as follows but is not working. Please Help: sedsed -i "s@'://your server name:port/test/owa'@'://11.22.33.44:5555/pls/SAMPLE'@g" homepage.htm Where, String1 ://your server name:port/test/owa String2... (3 Replies)
Discussion started by: koazter
3 Replies

8. Shell Programming and Scripting

Sed - remove special characters

Hi, I have a file with this line, it's always in the first line: I want to remove these special characters: ´╗┐ file1 ´╗┐\\bar\c$\test2\;3.348.118 Bytes;160 ;3 \\bar\c$\test\;35 Bytes;2 ;1 I want the same file to be only \\bar\c$\test2\;3.348.118 Bytes;160 ;3 \\bar\c$\test\;35... (4 Replies)
Discussion started by: nakaedu
4 Replies

9. Shell Programming and Scripting

sed special characters issues

I am dusting off the sed cobwebs and had a basic question: I have a file that contains: $firewall = "on"; $cache = "on"; $dataset{'mary had a little lamb'} = "on"; and want to only change the contents of what is between the single quotes: $dataset{'big bad wolf'} = "on"; I... (3 Replies)
Discussion started by: metallica1973
3 Replies

10. Shell Programming and Scripting

sed in a while loop with special characters

I have the foolowing data file: File1 <p name="A">5004</p> <p name="B">5004</p> <p name="C">5004</p> <p name="A">15004</p> <p name="B">15004</p> <p name="C">15004</p> In a while loop using sed (100 of line need to be replace), I need the output to File3:... (2 Replies)
Discussion started by: bobo
2 Replies
LINK(2) 						      BSD System Calls Manual							   LINK(2)

NAME
link, linkat -- make a hard file link LIBRARY
Standard C Library (libc, -lc) SYNOPSIS
#include <unistd.h> int link(const char *name1, const char *name2); int linkat(int fd1, const char *name1, int fd2, const char *name2, int flag); DESCRIPTION
The link() system call atomically creates the specified directory entry (hard link) name2 with the attributes of the underlying object pointed at by name1. If the link is successful: the link count of the underlying object is incremented; name1 and name2 share equal access and rights to the underlying object. If name1 is removed, the file name2 is not deleted and the link count of the underlying object is decremented. The object pointed at by the name1 argument must exist for the hard link to succeed and both name1 and name2 must be in the same file system. The name1 argument may not be a directory. The linkat() system call is equivalent to link except in the case where either name1 or name2 or both are relative paths. In this case a relative path name1 is interpreted relative to the directory associated with the file descriptor fd1 instead of the current working directory and similarly for name2 and the file descriptor fd2. Values for flag are constructed by a bitwise-inclusive OR of flags from the following list, defined in <fcntl.h>: AT_SYMLINK_FOLLOW If name1 names a symbolic link, a new link for the target of the symbolic link is created. If linkat() is passed the special value AT_FDCWD in the fd1 or fd2 parameter, the current working directory is used for the respective name argument. If both fd1 and fd2 have value AT_FDCWD, the behavior is identical to a call to link(). Unless flag contains the AT_SYMLINK_FOLLOW flag, if name1 names a symbolic link, a new link is created for the symbolic link name1 and not its target. RETURN VALUES
The link() function returns the value 0 if successful; otherwise the value -1 is returned and the global variable errno is set to indicate the error. ERRORS
The link() system call will fail and no link will be created if: [ENOTDIR] A component of either path prefix is not a directory. [ENAMETOOLONG] A component of either pathname exceeded 255 characters, or entire length of either path name exceeded 1023 characters. [ENOENT] A component of either path prefix does not exist. [EOPNOTSUPP] The file system containing the file named by name1 does not support links. [EMLINK] The link count of the file named by name1 would exceed 32767. [EACCES] A component of either path prefix denies search permission. [EACCES] The requested link requires writing in a directory with a mode that denies write permission. [ELOOP] Too many symbolic links were encountered in translating one of the pathnames. [ENOENT] The file named by name1 does not exist. [EEXIST] The link named by name2 does exist. [EPERM] The file named by name1 is a directory. [EPERM] The file named by name1 has its immutable or append-only flag set, see the chflags(2) manual page for more information. [EPERM] The parent directory of the file named by name2 has its immutable flag set. [EXDEV] The link named by name2 and the file named by name1 are on different file systems. [ENOSPC] The directory in which the entry for the new link is being placed cannot be extended because there is no space left on the file system containing the directory. [EDQUOT] The directory in which the entry for the new link is being placed cannot be extended because the user's quota of disk blocks on the file system containing the directory has been exhausted. [EIO] An I/O error occurred while reading from or writing to the file system to make the directory entry. [EROFS] The requested link requires writing in a directory on a read-only file system. [EFAULT] One of the pathnames specified is outside the process's allocated address space. In addition to the errors returned by the link(), the linkat() system call may fail if: [EBADF] The name1 or name2 argument does not specify an absolute path and the fd1 or fd2 argument, respectively, is neither AT_FDCWD nor a valid file descriptor open for searching. [EINVAL] The value of the flag argument is not valid. [ENOTDIR] The name1 or name2 argument is not an absolute path and fd1 or fd2, respectively, is neither AT_FDCWD nor a file descrip- tor associated with a directory. SEE ALSO
chflags(2), readlink(2), symlink(2), unlink(2) STANDARDS
The link() system call is expected to conform to ISO/IEC 9945-1:1990 (``POSIX.1''). The linkat() system call follows The Open Group Extended API Set 2 specification. HISTORY
The link() function appeared in Version 7 AT&T UNIX. The linkat() system call appeared in FreeBSD 8.0. The link() system call traditionally allows the super-user to link directories which corrupts the file system coherency. This implementation no longer permits it. BSD
April 10, 2008 BSD
All times are GMT -4. The time now is 05:01 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy