This is another example of why you should always tell us what operating system and shell you're using when you post a question in this forum.
From what I have seen in other threads in this forum recently, you might get the output you wanted with your code if you were running it on a Linux system. You certainly will not get what you want (and will get what you are seeing) if you run it on a UNIX or BSD system.
Either of the following should work reliably on any of these systems:
(which may produce varying numbers of spaces between the colon and the following number) or:
(which will only put one space between the colon and the number of lines in the truncated file).
It would also be more efficient if you moved the redirection from the printf to the end of the outer loop.
This User Gave Thanks to Don Cragun For This Post:
Hi,
this might be a basic question...
why is that wc -c counts 1 more per line than what is there.
for example,
> cat dum1.txt
123
12
> wc -c dum1.txt
7 dum1.txt
Thanks,
Sameer. (4 Replies)
I am no Unix administrator...I live in windows land.
I wrote a script to find files of certain names and process them but was later advised to avoid checking sparse files since it would use up a lot of resources and the files I was looking for were not there.
How do I avoid doing the find on... (3 Replies)
I am looking to a solution to the following problem. I have a very large file that looks something like this:
Each group of three numbers on each line are three probabilities that sum to one.
I want to output the maximum for each group of three. So desired output would be:
or... (6 Replies)
I have any XML ouput file(file name TABLE.xml), where the data is loaded in A SINGLE LINE, I need help in writting a ksh shell script which gives me the word counts of word <TABLE-ROW>
This is my input file.
<?xml version="1.0" encoding="UTF-8"?><!--Generated by Ascential Software... (4 Replies)
Hi all,
I want to put a check in my script to check if the same instance is already running and not finished and if not then does not allow it to run! in which part of my script I should put this? and any idea how I should write it? tx (4 Replies)
Hi,
I have a script which has the below line:
ps -ef | grep ${SCRIPT_NAME} | grep ksh | grep -v grep >> /tmp/instance.tmp
When the script is invoked through CRON, I get 2 lines in instance.tmp when actually only one instance is running:
cdrd 17790 17789 0 15:14:01 ? 0:00 /bin/ksh... (8 Replies)
In bash shell, how we can avoid the commands getting recorded in history file.
One way i can think of is :
export HISTSIZE=0
Is there any other way to achieve this?
Thanks (1 Reply)
under past circumstances, id be fine running commands like this:
case 1:
printf '%s\n' "${MASSIVETEXT}" | egrep "i am on the first line"
case 2:
vprintf '%s\n' "${MASSIVETEXT}" | egrep -v "i am on the first line"
This works fine. Bit it calls external utility "egrep" and "printf". ... (5 Replies)
Hi Gurus,
I need to remove duplicate line in file and update TRAILER (last line) record count. the file is comma delimited, field 2 is key to identify duplicated record.
I can use below command to remove duplicated. but don't know how to replace last line 2nd field to new count.
awk -F","... (11 Replies)