Hi,
how I can display a file with cat and printing the filename before each line.
e.g.
file1 {
one
two
three
four
five
}
Output:
file1:one
file2:two
file1:three
file1:four
file1:five (12 Replies)
Hi all,
I have a list of xml file. I need to split the files to a different files when see the <ko> tag.
The list of filename are
B20090908.1100-20090908.1200_CDMA=1,NO=2,SITE=3.xml
B20090908.1200-20090908.1300_CDMA=1,NO=2,SITE=3.xml
B20090908.1300-20090908.1400_CDMA=1,NO=2,SITE=3.xml
... (3 Replies)
I would like to wget a file "index.html" from a site which is lies in different subdirectories and is different in size. The index.html shall be concatenated or renamed to index01.html index02.html .... I would like to store this file in just one directory and use the option -nd. Though i can't get... (0 Replies)
I want to recursively cat the content of files in a directory e.g.
find /etc -type f -exec cat {} \;
But I want it to print the file name first and then the content. For example let's say /etc/statetab and /etc/colord.conf will be printed first then I want the output to look something like;
... (6 Replies)
I have a file
# cat /root/llll
11
22
33
44
When I cat this file content to a variable inside a shell script and echo that shell script, it does not show up as separate lines. I need echo output similar to cat.
cat /root/shell_script.sh
#!/bin/bash
var=`cat /root/llll`
echo $var (2 Replies)
#!/bin/bash
#
name=$1
type=$2
number=1
for file in ./**
do
if
then
filenumber=00$number
elif
then
filenumber=0$number
fi
tempname="$name""$filenumber"."$type"
if (4 Replies)
Hii,
Could someone help me to append string to the starting of all the filenames inside a directory but it should exclude .zip files and subdirectories.
Eg.
file1: test1.log
file2: test2.log
file3 test.zip
After running the script
file1: string_test1.log
file2: string_test2.log
file3:... (4 Replies)
I have a directory that is restricted and I cannot just copy the files need, but I can cat them and redirect them to a new directory. The files all have the date listed in them. If I perform a long listing and grep for the date (150620) I can redirect that output to a text file. Now I need to... (5 Replies)
This should recursively walk through all dirictories and
search for a specified string in all present files, if found
output manicured content (eg some regex) with CAT into
a specified directory (eg /tmp/)
one by one, keeping the original names
This is what I have so far, which seems to... (1 Reply)
I am trying to use awk to calculate the average of all lines in $2 for every file in a directory. The below bash seems to do that, but I cannot figure out how to capture the string before the _ as the output file name and have it be tab-delimeted. Thank you :).
Filenames in... (3 Replies)
Discussion started by: cmccabe
3 Replies
LEARN ABOUT HPUX
rename
rename(2) System Calls Manual rename(2)NAME
rename - change the name of a file
SYNOPSIS DESCRIPTION
The system call causes the source file to be renamed to target. If target exists, it is first removed. Both source and target must be of
the same type (that is, either directories or nondirectories), and must reside on the same file system.
If target can be created or if it existed before the call, guarantees that an instance of target will exist, even if the system crashes in
the midst of the operation.
If the final component of source is a symbolic link, the symbolic link is renamed, not the file or directory to which the symbolic link
points.
RETURN VALUE
returns the following values:
Successful completion.
Failure.
Neither file is affected. is set to indicate the error.
ERRORS
If fails, is set to one of the following values.
[EACCES] A component of either path prefix denies search permission.
[EACCES] The requested link requires writing to a directory without write permission.
[EBUSY] target or source is an existing directory that is the mount point for a mounted file system.
[EDQUOT] User's disk quota block or inode limit has been reached for this file system.
[EEXIST] target is a directory and is not empty.
[EFAULT] source or target points outside the allocated address space of the process. Reliable detection of this error is
implementation dependent.
[EINVAL] source is a parent directory of target, or an attempt is made to rename the or directory.
[EISDIR] target is a directory, but source is not.
[ELOOP] Too many symbolic links were encountered in translating either path name.
[ENAMETOOLONG] A component of either path name exceeds bytes while is in effect, or the entire length of either path name exceeds
bytes.
[ENOENT] A component of the source path does not exist, or a path prefix of target does not exist.
[ENOSPC] The destination directory cannot be extended because of a lack of space on the file system containing the directory.
[ENOTDIR] A component of either path prefix is not a directory.
[ENOTDIR] source is a directory, but target is not.
[EPERM] The directory containing source has the sticky bit set, and neither the containing directory nor the source are owned
by the effective user ID.
[EPERM] The target file exists, the directory containing target has the sticky bit set, and neither the containing directory
nor the target are owned by the effective user ID.
[EROFS] The requested link requires writing in a directory on a read-only file system.
[EXDEV] The paths named by source and target are on different logical devices (file systems).
AUTHOR
was developed by the University of California, Berkeley.
SEE ALSO open(2).
STANDARDS CONFORMANCE rename(2)