It is actually a project for work. I am using it to find a data file with the highest values, so I altered it here a little to just find the maximum number. How can I adjust it to read each number separated by spaces instead of hitting enter after each number?
You should have started off asking that, rather than asking us to fix a specific syntax error, then.
You've just 1 line of many numbers? Give us more details on the actual input file, pasting a sample of it if you could, and the desired output. I'd say awk is better suited than the shell for such a task though. Say you've a file of just numbers:
Should show the highest number in that file. It scans every line and every word. It assumes the max will be greater than 0 though, since it's not initialized.
That line replaces the whole script. I'm still confused as to what you want to do. Do you want to read from the keyboard or a file? Does the file only have 4 numbers in it on 1 line?
Hi
I want to delete a line from a txt file for which the line number is user input. Say when user selects 19, the 19th line would be deleted from the file. Can anyone please provide me with a sed one liner for the same... I tried sed -i. The interaction would be like this
Enter the line... (4 Replies)
So I have a loop that stated if a directory exists or not. If it does it prints the number of files within that directory. I use this code...
result=`(ls -l . | egrep -c '^-')`
However, no matter which directory I input, it outputs the number "2"
What is wrong here? (4 Replies)
Hi
I want to delete a line from a txt file for which the line number is user input. Say when user selects 19, the 19th line would be deleted from the file. Can anyone please provide me with a sed one liner for the same... I tried sed -i. The interaction would be like this
Enter the line to... (1 Reply)
Hi,
What is the maximum number of arguments that could be passed to zsh ?
To find out that I tried a simple script.
And the maximum number of arguments that could be passed turned out to be 23394
#! /bin/zsh
arg=1
i=1
subIndex=23000
while
do
arg=$arg" "$i
i=$(($i + 1))... (9 Replies)
Hi,
Can anyone help me? An input file has three lines. Each line should only be 2098 as number of characters however line 2 of the input file has more than the maximum number of characters, it exceeded up to 4098. What should I do so that could handle maximum number of characters? that it could... (1 Reply)