10-22-2019
I only printed the array to see what values were there and didn't change
IFS (I don't think anyway). Thank you
.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
I'm trying to write a function that redirects the contents of an
array to a file. The array contains the lines of a data file with
white space.
The function seems to preserve all white space when redirected
except that it seems to ignore newlines. As a consequence, the
elements of the... (7 Replies)
Discussion started by: ASGR
7 Replies
2. Shell Programming and Scripting
Hi Guys,
I have a file which has numbers in it separated by newlines as follows:
1.113
1.456
0.556
0.021
-0.541
-0.444
I am using the following code to store these in an array in bash:
FILE14=data.txt
ARRAY14=(`awk '{print}' $FILE14`) (6 Replies)
Discussion started by: npatwardhan
6 Replies
3. Shell Programming and Scripting
I have one file "file.a.b.c-d.r" that I would like to use to spawn 4 other files:
"file.a.b.1-A.r"
"file.a.b.1-B.r"
"file.a.b.1-C.r"
"file.a.b.1-D.r"
where the field "c-d" changes into my 1 and A-D.
I was doing this manually at the prompt with
> cp "file.a.b.c-d.r" "file.a.b.1-A.r"
>... (13 Replies)
Discussion started by: WSUToad
13 Replies
4. Shell Programming and Scripting
I have figured out how to grep the file like this:
echo `grep $(date +'%Y-%m-%d') Cos-01.csv | cut -d',' -f1`
The above line does echo the correct information from the lines in which my search criteria is found.
Now I am trying to get that information (Yes, just one column of every line) into... (6 Replies)
Discussion started by: TwelveDays
6 Replies
5. Shell Programming and Scripting
Writing a bash script for use with Geektool, pulls the battery info, and shuffles images around so that an Image geeklet can display the correct expression as the desktop background. (Eventually I intend to make it more intricate, based on more variables, and add more expressions)
I'm extremely... (1 Reply)
Discussion started by: The_Ardly374
1 Replies
6. UNIX for Dummies Questions & Answers
Hi,
I'm trying to write a bash script that takes a file and passes each line from the file into an array with elements separated by column.
For example:
Sample file "file1.txt":
1 name1 a first
2 name2 b second
3 name3 c third
and have arrays such as:
line1 = ( "1" "name1" "a"... (3 Replies)
Discussion started by: ShiGua
3 Replies
7. Shell Programming and Scripting
for a in {1..100}
do
awk '{ sum+=$a} END {print sum}' a=$a file1 > file2
done
I know I will get only one number if following the code above, how can I get 100 sum numbers in file2? (2 Replies)
Discussion started by: wanliushao
2 Replies
8. Shell Programming and Scripting
I'm working on a bash script to finish uploading a file.
I need a way to get $filesize so that "restart $filesize" will work.
Here is my script:
ftp -n -v <<END_SCRIPT
open ftp.$domain
user $user@$domain $password
size $file
restart $filesize
put $file
quit
END_SCRIPTWayne Sallee... (9 Replies)
Discussion started by: WayneSallee
9 Replies
9. Shell Programming and Scripting
Hi Team,
i have a web ui where user will be passing values and the output will be saved to a file say test with the following contents .
These below mentioned values will change according to the user_input
Just gave here one example
Contents of file test is given below
Gateway... (7 Replies)
Discussion started by: venkitesh
7 Replies
10. OS X (Apple)
Hi guys and gals...
MacBook Pro.
OSX 10.13.2, default bash terminal.
I have a flat file 1920 bytes in size of whitespaces only. I need to put every single whitespace character into a bash array cell.
Below are two methods that work, but both are seriously ugly.
The first one requires that I... (7 Replies)
Discussion started by: wisecracker
7 Replies
LEARN ABOUT DEBIAN
ndselect
NDSELECT(1) User Commands NDSELECT(1)
NAME
ndselect - select lines and fields for numdiff
DESCRIPTION
Usage: ndselect -h|--help|-v|--version or
ndselect [-b N][-e N][-s N][-F N][-L N][-I N][-S IFS][-x][-l PATH][-o PATH] [FILE]
Print to standard output a subset of lines and fields from a given file.
The argument after the options is the name of the file to read from. The complete path of the file should be given, a directory name is
not accepted. If no input file is specified, the program reads from the standard input.
Exit status: 0 in case of normal termination, -1 (255) in case of error
-b, --beginning, --start=N
Set to N the number of the first line to print (The default behavior is to start with line number 1)
-e, --end=N
Set to N the number of the last line that can be printed (The default behavior is to arrive till to the end of the file)
-s, --step=N
Set to N the increment to use when selecting the lines to print (The default value for the increment is 1)
-F, --first-field=N
Set to N the number of the first field to print (The default behavior is to start with field number 1)
-L, --last-field=N
Set to N the number of the last field that can be printed (The default behavior is to arrive till to the end of every line)
-I, --increment=N
Set to N the increment to use when selecting the fields to print (The default value for the increment is 1)
-S, --separator=IFS
Specify the set of characters to use to split the input lines into fields (The default set of characters is space, tab and newline).
-x, --omit-empty-lines
Do not print empty lines
-l, --warnings-to=PATH
Redirect warning and error messages from stderr to the indicated file
-o, --output=PATH
Redirect output from stdout to the indicated file
-h, --help
Show this help message
-v, --version
Show version number, Copyright, Distribution Terms and NO-Warranty
COPYRIGHT
Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Ivano Primi <ivprimi@libero.it>
License GPLv3+: GNU GPL version 3 or later, see <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.
SEE ALSO
The full documentation for ndselect is maintained as a Texinfo manual. If the info and ndselect programs are properly installed at your
site, the command
info numdiff
should give you access to the complete manual.
ndselect 5.6.0 January 2012 NDSELECT(1)