10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
My file (the output of an experiment) starts off looking like this,
_____________________________________________________________
Subjects incorporated to date: 001
Data file started on machine PKSHS260-05CP
**********************************************************************
Subject 1,... (9 Replies)
Discussion started by: samonl
9 Replies
2. Shell Programming and Scripting
I am passing a variable and replace nth value with the variable.
I tried using many options in awk command but unable to ignore the special characters in the output and also unable to pass the actual value.
Input : "1","2","3"
Output : "1","1000","3"
TempVal=`echo 1000`
Cat... (2 Replies)
Discussion started by: onesuri
2 Replies
3. Shell Programming and Scripting
Using Awk, how can I achieve the following?
I have set of record numbers, for which, I have to replace the nth field with some values, say spaces.
Eg:
Set of Records : 4,9,10,55,89,etc
I have to change the 8th field of all the above set of records to spaces (10 spaces).
Its a delimited... (1 Reply)
Discussion started by: deepakwins
1 Replies
4. Shell Programming and Scripting
I have a need to print nth field based on the parameter passed. Suppose I have 3 fields in a file, passing 1 to the function should print 1st field and so on.
I have attempted below function but this throws an error due to incorrect awk syntax.
function calcmaxlen
{
FIELDMAXLEN=0
... (5 Replies)
Discussion started by: krishmaths
5 Replies
5. UNIX for Dummies Questions & Answers
I have the below 2 files:
1) Third field from file1.txt should be compared to the first field of lookup.txt.
2) If match found then third field, file1.txt should be substituted with the second field from lookup.txt.
3)Else just print the line from file1.txt.
File1.txt:... (4 Replies)
Discussion started by: venalla_shine
4 Replies
6. Shell Programming and Scripting
How do I do the product of nth filed just like sum. For sum I know like
awk '{ sum += $12 } END {printf "%.2f\n", sum}'
works as initial sum = 0.
But for product how do initialize the variable to 1? (2 Replies)
Discussion started by: madhavb
2 Replies
7. Shell Programming and Scripting
Hi,
Is there any short method to print from a particular field till another filed using awk?
Example File:
File1
====
1|2|acv|vbc|......|100|342
2|3|afg|nhj|.......|100|346
Expected output:
File2
====
acv|vbc|.....|100
afg|nhj|.....|100 (8 Replies)
Discussion started by: machomaddy
8 Replies
8. Shell Programming and Scripting
dear,
I have below file called folderlist.txt
# ParentFolder environment_flag SubFolders
triss 1 checksum
bookstructure 1
fx 1 checksum_GMDB
I have a script which which will create the folders under... (3 Replies)
Discussion started by: manas_ranjan
3 Replies
9. Shell Programming and Scripting
Hi All,
I wanted to find 200th field value in delimiter file using awk.?
awk '{print $200}' inputfile
I am getting error message :-
awk: The field 200 must be in the range 0 to 199.
The source line number is 1.
The error context is
{print >>> $200 <<< }
using... (4 Replies)
Discussion started by: Jairaj
4 Replies
10. Shell Programming and Scripting
Below is the format of my file which consist of
1)BSB
2)BSB/ADS
3)CIB
4)CIB/CRH
5)CIB/DCC
6)CIB/EMD
7)CIB/GDSPresentation
8)CIB/HCH
9)CIB/HSM
10)CIB/MCH
11)CIB/RCH
12)COB
13)DCI
14)DIB
15)DIB/H2H
16)DIB/HotelSync
17)DIB/UADBA (11 Replies)
Discussion started by: rohit22hamirpur
11 Replies