I'm a Linux newb, I've been running a Debian Linux server for about a year now, and I've written some simple scripts to automate various things, but I still don't know much, and I forget what I learn as fast as I figure it out... Anyway, that really isn't important, I just want you to know that... (14 Replies)
I am reading a file and copying selected lines from the file into another using echo.
For eg:
while read line
do
if ((some logic to determine whether I need to copy the current line to another file))
then
echo $line > tempfile
fi
done<srcfile
The problem I have is the data in the file... (1 Reply)
I am searching while I await a response to this so if it has been asked already I apologize.
I have a file with lines in it that look like:
bob johnson email@email.org
I need it to look like:
bob:johnson:email@email.org
I am trying to use sed like this:
sed -e 's/ /:/g' file >... (5 Replies)
Hi,
I should read one character at a fixed position from each line of the file. So how ??? should be substituted in the code below:
while read line ; do
single_char=`???`
echo "$single_char"
done < $input_file (8 Replies)
I am trying to read a txt file and trying to translate multiples spaces into single spaces so the file is more organized, but whenever I try the command:
tr ' ' ' ' w.txt
The output is:
tr: extra operand `w.txt'
Try `tr --help' for more information.
Can someone please help? :wall:
... (2 Replies)
I have a file proc.txt:
if @debug = 1 then
message 'Start Processing ', @procname, dateformat(now(*), 'hh:mm:ss'), @julian type info to client;
end if;
/*
execute immediate with quotes
'insert into sys_suppdata (property, value, key_name)
location ''' || @supp_server || '.' ||... (5 Replies)
I am new to shell scripting and wished to get few things clarified.
While calling functions within shell script, output comes out as single line irrespective of the no of echos or newlines I tried within function +
the echo -e used to invoke function ( as instructed online) :
#!/bin/sh
inc() {... (1 Reply)
Hi,
In a csv file, I want to select records where first column has zero or multiple spaces.
Eg: abc.csv
,123,a
,22,b
,11,c
a,11,d
So output should be:
,123,a
,22,b
,11,c
Please advise (5 Replies)
Hi All.
Attached are two files.
I ran a query and have the output as in the file with name "FILEWITHFOURRECORDS.txt "
I didn't want all the spaces between the columns so I squeezed the spaces with the "tr" command and also added a carriage return at the end of every line.
But in two... (3 Replies)
Hello,
This is Solaris 10 (x86)
bash-3.2# cat /etc/release
Solaris 10 5/09 s10x_u7wos_08 X86
Copyright 2009 Sun Microsystems, Inc. All Rights Reserved.
Use is subject to license terms.
Assembled 30 March... (5 Replies)
Discussion started by: solaris_1977
5 Replies
LEARN ABOUT ULTRIX
ftruncate
truncate(2) System Calls Manual truncate(2)Name
truncate, ftruncate - truncate a file to a specified length
Syntax
truncate(path, length)
char *path;
int length;
ftruncate(fd, length)
int fd, length;
Description
The system call causes the file named by path or referenced by fd to be truncated to, at most, length bytes in size. If the file previ-
ously was larger than this size, the extra data is lost. With the file must be open for writing.
Return Values
A value of zero (0) is returned if the call succeeds. If the call fails, a -1 is returned, and the global variable errno specifies the
error.
Restrictions
Partial blocks discarded as the result of truncation are not zero-filled. This can result in holes in files that do not read as zero.
Diagnostics
The system call succeeds unless:
[ENOTDIR] A component of the path prefix is not a directory.
[ENOENT] The named file does not exist.
[EACCES] Search permission is denied for a component of the path prefix.
[EISDIR] The named file is a directory.
[EROFS] The named file resides on a read-only file system.
[ETXTBSY] The file is a pure procedure (shared text) file that is being executed.
[EFAULT] The path points outside the process's allocated address space.
[ENAMETOOLONG] A component of a pathname exceeded 255 characters, or an entire path name exceeded 1023 characters.
[ELOOP] Too many symbolic links were encountered in translating the pathname.
[EIO] An I/O error occurred updating the inode.
The system call succeeds unless:
[EBADF] The fd is not a valid descriptor.
[EINVAL] The fd references a socket, not a file.
[ETIMEDOUT] A connect request or remote file operation failed, because the connected party did not properly respond after a period of
time that is dependent on the communications protocol.
See Alsoopen(2)truncate(2)