You don't want a nested loop, then. Perhaps something like:
Code:
set -- a b c # Set $1=a, $2=b, $3=c
for X in 1 2 3
do
Y="$1"
shift 1 # $1=a, $2=b, $3=c becomes $1=b, $2=c
echo "filepath/$X/ command modified by $Y"
done
You don't want a nested loop, then. Perhaps something like:
Code:
set -- a b c # Set $1=a, $2=b, $3=c
for X in 1 2 3
do
Y="$1"
shift 1 # $1=a, $2=b, $3=c becomes $1=b, $2=c
echo "filepath/$X/ command modified by $Y"
done
Hi, thanks for your response. I copy and pasted your code, ran it and get many errors:
test.sh: line 5: *: command not found
test.sh: line 6: *: command not found
test.sh: line 8: *: command not found
test.sh: line 5: *: command not found
test.sh: line 6: *: command not found
test.sh: line 8: *: command not found
test.sh: line 5: *: command not found
test.sh: line 6: *: command not found
test.sh: line 8: *: command not found
---------- Post updated at 10:55 AM ---------- Previous update was at 10:52 AM ----------
This also requires manually pairing the two sets of variables, no? Assume that the list of variables is more like 100x100 (strings x numeric), of something like {a, b, c...} x {1, 2, 3...}.
The code I gave works when pasted word for word, letter for letter. It definitely has no * in line 6. Show me what you actually did, and I can tell you why it didn't work.
Also, show your actual input and I can show you how to use it.
The code I gave works when pasted word for word, letter for letter. It definitely has no * in line 6. Show me what you actually did, and I can tell you why it didn't work.
Also, show your actual input and I can show you how to use it.
Code:
for s in amygSMA_R
do
for n in
ANUP ANVA ANYA ANZH ARMU BELA CAWI CHAZ CHJO CHSC CHSH CRSW DAHA DIWE DOWI ELBU GLGO HOCH JASH JEAM JERE JOWR JYAK KABL KAGI KARO KRAR LAFR LATE LICR MAGE MEWE MILE MIWA NALU NYSH NYWE PAMA SATI SHCO SHME STAL SWPA TAGR TIKI UZOM
for x in 1712 1922 2001 1700 1743 1860 2017 1838 2190 1750 1973 1909 2075 1843 1906 2103 1957 1813 1888 1961 1893 1772 2038 1957 1959 2055 2036 1903 1775 1839 2144 2322 1844 1855 1722 1731 1722 2038 1788 1856 1949 1837 1864 1847 1831
do
fslmaths /filepath/$s/$n/fdt_paths -thr $x -bin fdt_paths_thr
echo $s
done
done
done
***
The above would do ANUP with every number but I just want it to do ANUP with 1712, ANVA with 1922, etc.
Moderator's Comments:
edit by bakunin: please use CODE-tags for code, data, terminal output and the like, but especially for CODE! That is what the tag is for. Thank you.
readNOW=$(date +"%Y%m%d%H%M")
read readTerminal #input B
terminalc=$readTerminal
echo eqpt_list_QC_$terminalcT_$readNOW
how to get display result it:
eqpt_list_QC_BT_201209121530 (2 Replies)
I expert,
I may cross post something similar but I dirtyed my quesion somehow to be clear in the thread
#cat file1
88dee gcc: Grok for callconvention-hard to enable hard float
a2ad2 eglibc: package mtrace separately
61487 python: bump PR of packages after update of distutils.bbclass... (1 Reply)
Hi everybody,
I'm trying to use a foreach command with two lists. The file.txt looks like this:
var1: 100 200 300
var2: 3 6 9
I'm trying to use a foreach command to associate the two variables together. My script looks like this:
#! /bin/tcsh
set a=(`cat file.txt | grep 'var1' | cut -d... (8 Replies)
I'm working with a file with an xml structure. I'd like to parse it down to just the bits i want. Here is and example of the file
<message id="96352877" method="status">
<date rfc="Sat, 12 Mar 2011 16:13:15 -0600" unix="1299967995" />
<services>
<service id="facebook"... (4 Replies)
Okay, I've made threads on extracting fields and comparing strings in separate files in .csv's. I've written the following code with intentions of learning more.
I just want this one question answered: How can I assign fields from a file(comma separated) to variables?
My goal is to check... (0 Replies)
File_A contains Strings:
a
b
c
d
File_B contains Strings:
a
c
z
Need to have script written in either sh or ksh. Derive resultant files (File_New_A and File_New_B) from lists File_A and File_B where string elements in File_New_A and File_New_B are listed below.
Resultant... (7 Replies)
Within one of my scripts, I have variables extracted from parameters list and want to combine some of them in one (lpath). I tried using awk command..... How do I get it? Thank you.
#!/bin/bash
# ## Read paramlist.txt
file='/name1/name2/paramlist.txt'
while read line
do
#
key= echo... (4 Replies)
Within one of my awk scripts, I have three variables extracted and calculated on. When done, I simply want to combine the three. The following works, but looks weird. My script reads a field that has text and numbers, knowing the last four comprise MMYY (month and year)
# YY are last two... (2 Replies)