Questions tagged [ifs]

IFS is a variable in Unix shells (Bourne, POSIX sh, bash, ksh, …) that controls how unescaped substitutions are split into words.

IFS (short for "input field separator" and often referred to as "internal field separator") is a variable in Unix shells (, , , , , , , , …) that controls how strings are split into multiple fields. Most notably, variable substitutions (e.g. $foo) which are not inside double quotes or in a few other protected locations are split into multiple fields based on the value of IFS; the same goes for command substitutions (e.g. $(foo)). Each character that is present in IFS is a field separator. The default value contains a space, a tab and a newline.

For other meanings of the acronym IFS, use the appropriate tag:

  • IBM Integrated file system
  • QNX Image Filesystem
  • ERP by Industrial and Financial Systems AB
293 questions
2
votes
1 answer

Using ARRAYFORMULA with SUMIF for multiple conditions combined with a wildcard to select all values for a given condition

I am using ARRAYFORMULA with multiple conditions using SUMIF concatenating the conditions using & and it works. Now I would like to use similarly this idea for a special condition indicating to consider all values using a wildcard ("ALL") for a…
David Leal
  • 6,373
  • 4
  • 29
  • 56
2
votes
2 answers

Google Sheets: Determining if a time falls within a two specified times

I'm trying to find a way to determine if a time falls between two specific times - with two different scenarios to flag. So far, I'm coming up empty (and frustrated!) Column B has date/times such as: February 9, 2022 09:55AM February 9, 2022…
HiDrew
  • 25
  • 4
2
votes
3 answers

Google Sheets ARRAYFORMULA to skip blank rows

How to make my ARRAYFORMULA(A1 + something else) to stop producing results after there are no more values in A1 column, eg. to skip blank values. By default it gives endlessly "something else". Here is my demo…
2
votes
1 answer

Getting an formula parse error on a basic if statement

I am trying to use IF statement in a Google Sheet, but whatever I am typing in the IF I am always getting a formula parse error. Do I have to activate something, or am I missing something ? A1 & B1 have the same type (integer) I have no idea…
2
votes
1 answer

IFS working as expected when in bash, not working properly in zsh

OS: Monetary (12.0.1) default shell: zsh (5.8) #!/bin/zsh LINE="I:would:like:coffee." IFS=: set $LINE echo $1 echo $2 echo $3 echo $4 exit 0 ./script.sh zsh ./script.sh Both ways of running the script returned I:would:like:coffee. Only when…
2
votes
1 answer

Writing into IFS file a variable size string

I'm writing a file in iSeries IFS. My variable File_Data is a 32000A, so when I use CallP Write(FileD : %Addr(File_Data) : %Size(File_Data) ) I find some unuseful spaces when the Variable is not…
Nifriz
  • 1,033
  • 1
  • 10
  • 21
2
votes
1 answer

Multiple VLOOKUP's

https://docs.google.com/spreadsheets/d/1Gicj7hiR80NQzwBsn535gFAV4xn1lZvcXP1ch6U23pQ/edit?usp=sharing This is a copy of the Sheet I designed with lots of googling. I've sanitized the customer info and put generics in and erased non-pertinent…
2
votes
1 answer

Save specific part of curl response to variable

I'm currently working on a bash script and I want to save a specific part of a curl-command output to a variable. This is my curl command with some test parameters: curl -k -I --header "Accept: application/*;version=34.0" --header "Authorization:…
Jaw. M.
  • 139
  • 2
  • 15
2
votes
1 answer

How do I stop `read` with `IFS` from merging together whitespace characters?

Take this piece of code that reads in data separated by | DATA1="Andreas|Sweden|27" DATA2="JohnDoe||30" # <---- UNKNOWN COUNTRY while IFS="|" read -r NAME COUNTRY AGE; do echo "NAME: $NAME"; echo "COUNTRY: $COUNTRY"; echo "AGE: …
IQAndreas
  • 8,060
  • 8
  • 39
  • 74
2
votes
1 answer

How can I only run a calculation in Google Sheets, if the cell is not empty?

basically, I'd like to get the percentage differences between two numbers, but only if there is data/numbers in those cells. I don't want the formula to run if there is not any data in the cell, as this will give me a div error.
2
votes
3 answers

IFS not parsing well CSV

I am trying to parse a file so I can obtain the first column. The command I'm using is: while IFS=',' read -r a; do echo "$a"; done < test.csv However it is still outputting the whole csv instead of the first column. An example of the csv is as…
js352
  • 364
  • 2
  • 9
2
votes
2 answers

Bash IFS is ignoring the delimiter at the end of line

I have a file with full of key value pairs. I wrote this shell script which reads each line and split key value. while IFS='=' read -r key value do something done < < application.properties. One of the property looks like…
Venu S
  • 3,251
  • 1
  • 9
  • 25
2
votes
1 answer

Error: IFS expects all arguments after position 0 to come in pairs

I'm trying to reference a cell depending on the value of A2, but when I use the following code, I get an #N/A error. My google is not in English, so I don't know the exact translation, but it's something about the IFS function wanting all arguments…
KungenSam
  • 65
  • 1
  • 6
2
votes
1 answer

bash reading multiple files with 'while read'

When I have a single textfile that I want to read line-by-line with bash, the command looks like: while IFS='' read -r line || [[ -n "${line}" ]]; do [code goes here] done <(${filename}) Now, I have several files (named 1.txt through 10.txt),…
WX_M
  • 458
  • 4
  • 20
2
votes
2 answers

Google Sheets' query + IFS function

I want to use IFS and Query in google sheet at the same time. Works Well =QUERY('PN Orders'!A1:AF,"SELECT C, D where C LIKE '%" & $B$1& "%' and D LIKE '%" & $B$2& "%' LIMIT " &$B$3,1) above query works well, get results. But every time I combine…