hi,
i have file say email.temp looks like
Bell_BB 17
Bell_MONTHLY 888
SOLO_UNBEATABLE 721
and another file r3
Bell BB,Bell_BB
Bell,Bell_MONTHLY
SOLO,SOLO_UNBEATABLE
i want email.temp files $1 say Bell_BB should be replaced by r3 Bell BB and Bell_MONTHLY by... (2 Replies)
Ok, so, let's say I have the variable $GMAILID....How can I use it with sed command so to replace a string in a file? e.g.:
sed -i 's/$GMAILID/test@gmail.com/' /home/$USER/Desktop/sendmail (4 Replies)
Can you please point me in the correct direction?
I need a line or script to run though a given directory and find all files with "@domain.local" in there names and simple remove that.
For example if the files were named 1234@domain.local the file would then become 1234. (1 Reply)
My apologies if this has been answered in a previous post. I've been doing a lot of searching, but I haven't been able to find what I was looking for. Specifically, I am wondering if I can utilize sed and/or awk to locate two strings in a file, and replace everything between those two strings... (12 Replies)
Hi all,
Hereby wish to have your advise for below:
Main concept is
I intend to get current directory of my script file.
This script file will be copied to /etc/init.d.
A string in this copy will be replaced with current directory value.
Below is original script file:
... (6 Replies)
Hi experts,
In my text file I have the following alot of lines like below.
input.k is as follows.
2684717 -194.7050476 64.2345581 150.6500092 0 0
2684718 -213.1575623 62.7032242 150.6500092 0 0
*INCLUDE
$# filename... (3 Replies)
Hi,
I am trying to replace the value of a variable in a file through another script.
Example:
Filename : abc.txt contents:
a=10
b=20
c=30
Need to change the value of, say, b - Tried using the following:
sed "s/${b}/15/g" abc.txt
Have tried various forms of sed (with single quotes,... (4 Replies)
My first comment on every file contains the license message. I want to replace with a new license message. I used the below sed script, which replaces all comments. What is the modification or any other method with awk script for the below to edit only the first comment(license message)?
#sed -f... (1 Reply)
I have a file having some text like:
PATH_ABC=/user/myLocation
I have to replace "/user/myLocation" with a session variable say, $REPLACE_PATH,
where $REPLACE_PATH=/user/myReplaceLocation
The following sed command is not working. It is writing PATH_ABC=$REPLACE_PATH in the file
... (2 Replies)
Dear All,
I am having a requirement to find the difference between 2 files and generate a discrepancy report out of it as an html page. I prefer using diff -y file1 file2 since it gives user friendly layout to know any discrepancy in the record and unique records among the 2 file. Here's how it... (12 Replies)
Discussion started by: Badhrish
12 Replies
LEARN ABOUT NETBSD
getline
GETDELIM(3) BSD Library Functions Manual GETDELIM(3)NAME
getdelim, getline -- read a delimited record from a stream
LIBRARY
Standard C Library (libc, -lc)
SYNOPSIS
#include <stdio.h>
ssize_t
getdelim(char ** restrict lineptr, size_t * restrict n, int delimiter, FILE * restrict stream);
ssize_t
getline(char ** restrict lineptr, size_t * restrict n, FILE * restrict stream);
DESCRIPTION
The getdelim() function reads from the stream until it encounters a character matching delimiter, storing the input in *lineptr. The buffer
is NUL-terminated and includes the delimiter. The delimiter character must be representable as an unsigned char.
If *n is non-zero, then *lineptr must be pre-allocated to at least *n bytes. The buffer should be allocated dynamically; it must be possible
to free(3) *lineptr. getdelim() ensures that *lineptr is large enough to hold the input, updating *n to reflect the new size.
The getline() function is equivalent to getdelim() with delimiter set to the newline character.
RETURN VALUES
The getdelim() and getline() functions return the number of characters read, including the delimiter. If no characters were read and the
stream is at end-of-file, the functions return -1. If an error occurs, the functions return -1 and the global variable errno is set to indi-
cate the error.
The functions do not distinguish between end-of-file and error, and callers must use feof(3) and ferror(3) to determine which occurred.
EXAMPLES
The following code fragment reads lines from a file and writes them to standard output.
char *line = NULL;
size_t linesize = 0;
ssize_t linelen;
while ((linelen = getline(&line, &linesize, fp)) != -1)
fwrite(line, linelen, 1, stdout);
if (ferror(fp))
perror("getline");
ERRORS
[EINVAL] lineptr or n is a NULL pointer.
[EOVERFLOW] More than SSIZE_MAX characters were read without encountering the delimiter.
The getdelim() and getline() functions may also fail and set errno for any of the errors specified in the routines fflush(3), malloc(3),
read(2), stat(2), or realloc(3).
SEE ALSO ferror(3), fgets(3), fopen(3)STANDARDS
The getdelim() and getline() functions conform to IEEE Std 1003.1-2008 (``POSIX.1'').
BSD June 30, 2010 BSD