12-01-2008
You are clobbering the file before the modification.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hello,
I have the following to remove spaces from beginning and end of a string.
infile=`echo "$infilename" | sed 's/^ *//;s/ *$//`
How do I modify the above code to remove spaces from beginning, end and in the middle of the string also.
ex:
... (4 Replies)
Discussion started by: radhika
4 Replies
2. Shell Programming and Scripting
Hi Forum.
I tried searching the forum but couldn't find a solution for my question.
I have the following data and would like to have a sed syntax to remove the leading zeroes from the 2nd field only:
Before:
2010-01-01|123|1|1000|2000|500|1500|600|700... (18 Replies)
Discussion started by: pchang
18 Replies
3. Shell Programming and Scripting
if the answer is obvious, sorry, I'm new here.
anyway, I'm using tr to encrypt with rot-13:
echo `cat $script | tr 'a-zA-Z' 'n-za-mN-ZA-M'` > $script
it works, but it removes any consecutive spaces so that there is just one space between words. I've had this problem before while using sed to... (5 Replies)
Discussion started by: Trichopterus
5 Replies
4. Shell Programming and Scripting
Hi all,
i am getting count from oracle 11g by spooling it to a file.
Now there are some newline characters and blank spaces i need to remove these.
pl provide me a awk/sed solution.
the spooled file is attached.
i tried this.. but not getting req o/p (6 Replies)
Discussion started by: rishav
6 Replies
5. Shell Programming and Scripting
Solaris, ksh
I have a .csv file I am trying to clean up before loading into the database. The file contains comma separated columns that have leading spaces which I need to remove. The trouble is, some columns that should not be touched are strings which happen to have the same pattern in them. ... (4 Replies)
Discussion started by: gary_w
4 Replies
6. OS X (Apple)
Hi All,
I have a vexing issue with leading spaces in file names. Basically, we're moving tons of data from our ancient afp file share to Box.com and Box forbids leading spaces in files or folders. The HFS file system seems to be perfectly fine with this, but almost all other Unix file systems... (1 Reply)
Discussion started by: prometheon123
1 Replies
7. UNIX for Dummies Questions & Answers
Hi again
I have an xml file and want to remove the leading white space as it causes me issues later in my script
I see sed is possible but cant seem to get it to work
I tried
sed 's/^ *//' file.xml
output
<xn:VsDataContainer id="1U104799" modifier="update">
... (10 Replies)
Discussion started by: aniquebmx
10 Replies
8. Shell Programming and Scripting
The following command works echo "some text with spaces" | sh -c 'sed -e 's/t//g''But this doesn't and should echo "some text with spaces" | sh -c 'sed -e 's/ //g''Any ideas? (3 Replies)
Discussion started by: Tribe
3 Replies
9. Shell Programming and Scripting
Hi,
I am trying to remove leading and trailing spaces from a file using awk but somehow I have not been able to do it.
Here is the data that I want to trim.
07/12/2017 15:55:00 |entinfdev |AD ping Time ms | .474| 1.41| .581|green |flat... (9 Replies)
Discussion started by: svajhala
9 Replies
10. Shell Programming and Scripting
OS : RHEL 6.7
Shell : bash
I am trying to remove the leading the spaces in the below file
$ cat pattern2.txt
hello1
hello2
hello3
hello4
Expected output is shown below.
$ cat pattern2.txt
hello1
hello2
hello3
hello4 (2 Replies)
Discussion started by: John K
2 Replies
utime(2) System Calls Manual utime(2)
NAME
utime() - set file access and modification times
SYNOPSIS
DESCRIPTION
The system call sets the access and modification times of the file to which the path argument refers.
If times is a NULL pointer, the access and modification times of the file are set to the current time. A process must be the owner of the
file or have write permission on the file to use in this manner.
The following times in the structure defined in are measured in seconds since 00:00:00 UTC (Coordinated Universal Time), January 1, 1970.
time_t actime; /* access time */
time_t modtime; /* modification time */
Security Restrictions
If times is not a NULL pointer, times is interpreted as a pointer to a utimbuf structure, and the access and modification times are set to
the values contained in the designated structure. Only the owner of the file or a user with the privilege can use this way.
See privileges(5) for more information about privileged access on systems that support fine-grained privileges.
RETURN VALUE
returns the following values:
Successful completion.
Failure.
is set to indicate the error.
ERRORS
If fails, is set to one of the following values.
Search permission is denied by a component of the path prefix.
The effective user ID is not a
user with the privilege, and not the owner of the file, times is a NULL pointer, and write access is denied.
times is not a NULL pointer, and it points outside the process's allocated address space. The reliable detection of this
error is implementation-dependent.
path points outside the process's allocated address space. The reliable detection of this error is implementation-depen-
dent.
times is not a NULL pointer, and access time or modification time or both are negative.
The length of the specified path name exceeds
bytes, or the length of a component of the path name exceeds bytes while is in effect.
The named file does not exist.
A component of the path prefix is not a directory.
The effective user ID is not a
user with the privilege, and not the owner of the file, and times is not a NULL pointer.
The file system containing the file is mounted read-only.
DEPENDENCIES
NFS
may return when invoked on a remote file owned by a superuser, or users with and privileges, even if the invoking user has write permission
on the file.
See privileges(5) for more information about privileged access on systems that support fine-grained privileges.
SEE ALSO
touch(1), stat(2), privileges(5).
STANDARDS CONFORMANCE
utime(2)