09-25-2018
In addition to what Don Cragun said: Which exact command die you use to get the hex dump output?
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
How to convert ^M appearing at end of line to unix newline?
As I have tried with ^M in 'tr' it replaced ^ to a newline.
Thanks in advance. (21 Replies)
Discussion started by: videsh77
21 Replies
2. Shell Programming and Scripting
Hi All,
Is there any way to append a newline character at the end of a file(coma-separated file), through shell script?
I need to check whether newline character exists at the end of a file, if it does not then append it.
Regards,
Krishna (1 Reply)
Discussion started by: KrishnaSaran
1 Replies
3. Shell Programming and Scripting
Hi All,
I have named a file with current date,time and year as follows:
month=`date | awk '{print $2}'`
date=`date | awk '{print $3}'`
year=`date | awk '{print $6}'`
time=`date +%Hh_%Mm_%Ss'`
filename="test_"$month"_"$date"_"$year"_"$time".txt"
> $filename
The file is created with a... (2 Replies)
Discussion started by: amio
2 Replies
4. Shell Programming and Scripting
Hi,
I want to add \n as a EOF at the end of file if it does't exist in a single command. How to do this?
when I use command
echo "1\n" > a.txt
and
od -c a.txt
0000000 1 \n \n
0000003
How does it differentiate \n and eof in this case?
Regards,
Venkat (1 Reply)
Discussion started by: svenkatareddy
1 Replies
5. Shell Programming and Scripting
Hi Guyz,
I have an XML message in following format:
I want my contents to be formatted in following order:
i.e. I want a newline after every XML tag end.
How to do this?
Thnx in advance. (5 Replies)
Discussion started by: DTechBuddy
5 Replies
6. Shell Programming and Scripting
My source file is pipe delimeted file with 53 fields.In 33 rd column i am getting mutlple new line characters,dule to that record is breaking into multiple records.
Note : here record delimter also \n
sample Source file with 6 fields :
1234|abc| \nabcd \n bvd \n cde \n |678|890|900\n
... (6 Replies)
Discussion started by: lakshmi001
6 Replies
7. Shell Programming and Scripting
Hi All,
I have following piece of code in UNIX C Shell script and I want to add one more command which can add newline at the end of file only if there is no newline character exists.
foreach file (`ls $dd_PLAYCARD_EDI_IN`)
if ( -f $dd_PLAYCARD_EDI_IN/${file} ) then
cat -n... (4 Replies)
Discussion started by: jnrohit2k
4 Replies
8. Shell Programming and Scripting
Hi Gurus,
Need help. I'm a beginner in Unix. I have a requirement, need to add or append newline (\n) character in file.
Sample Data:
1|Main|Test|~#
2|Main|Hello|~#
3|Main|Unix|~#
4|Main|File|~#Output:
1|Main|Test|~#
2|Main|Hello|~#
3|Main|Unix|~#
4|Main|File|~#\n -- append only... (13 Replies)
Discussion started by: Gouri Solleti
13 Replies
9. Shell Programming and Scripting
Hi,
I am trying to sort a csv file which has say 10 lines each line having a row size that is upto 30183 no. of COLUMNS (Row length = 30183). There is a LINE FEED (LF) at the end of each line. When I try to sort this file say, based on the second FIELD using the below command,
sort -t ',' +1... (5 Replies)
Discussion started by: DHeisenberg
5 Replies
10. Shell Programming and Scripting
I have requirement to remove the /n ( newline ) characters from the file.
When I open file in VI .. I want to see newline char
how to display newline char .. or where can I see the content with newline char visible? (3 Replies)
Discussion started by: freakabhi
3 Replies
LEARN ABOUT REDHAT
shrinkfile
SHRINKFILE(1) General Commands Manual SHRINKFILE(1)
NAME
shrinkfile - shrink a file on a line boundary
SYNOPSIS
shrinkfile [ -n ] [ -m maxsize ] [ -s size ] [ -v ] file...
DESCRIPTION
The shrinkfile program shrinks files to a given size if the size is larger than maxsize,
preserving the data at the end of the file. Truncation is performed on line boundaries, where a line is a series of bytes ending with a
newline,
. There is no line length restriction and files may contain any binary data.
Temporary files are created in the <pathtmp in inn.conf> directory. The ``TMPDIR'' environment variable may be used to specify a different
directory.
A newline will be added to any non-empty file that does not end with a newline. The maximum file size will not be exceeded by this addi-
tion.
OPTIONS
-s By default, size is assume to be zero and files are truncated to zero bytes. By default, maxsize is the same as size. If maxsize
is less than size, maxsize is reset to size. The ``-s'' flag may be used to change the truncation size. Because the program trun-
cates only on line boundaries, the final size may be smaller then the specified truncation size. The size and maxsize parameter may
end with a ``k'', ``m'', or ``g'', indicating kilobyte (1024), megabyte (1048576) or gigabyte (1073741824) lengths. Uppercase let-
ters are also allowed. The maximum file size is 2147483647 bytes.
-v If the ``-v'' flag is used, then shrinkfile will print a status line if a file was shrunk.
-n If the ``-n'' flag is used, then shrinkfile will exit 0 if any file is larger than maxsize and exit 1 otherwise. No files will be
altered.
EXAMPLES
Example usage:
shrinkfile -s 4m curds
shrinkfile -s 1g -v whey
shrinkfile -s 500k -m 4m -v curds whey
if shrinkfile -n -s 100m whey; then echo whey is way too big; fi
HISTORY
Written by Landon Curt Noll <chongo@toad.com> and Rich $alz <rsalz@uunet.uu.net> for InterNetNews.
SEE ALSO
inn.conf(5)
SHRINKFILE(1)