03-14-2013
Totally answered my problem. Been working on this for a week. Finished reading the O'Reilly book on bash scripting but could find the answer. It's good but doesn't go into too much detail on sed or awk. Thanks.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
I'm trying this command - but get this error.
Do you guys have any workaround for this?
cat tf|sed 's/{//g'|sed 's/,//g'|awk '{for (i=1;i<=NF;i++) {if ($i == "OPTIME") {k = i + 2; print $i,$k}}}'
awk: record `2005 Jul 28 17:35:29...' has too many fields
record number 15
This is how... (3 Replies)
Discussion started by: chaandana
3 Replies
2. Shell Programming and Scripting
Hi all,
I have an input file with no delimiter. Let us say the file is abc.txt having values for fields namely, EmpNumEnameDesigSalDept. Ofcourse the file has got several records. Every field has got a fixed start and end position.
I need to assign the fields to corresponding varibles say... (1 Reply)
Discussion started by: rinku11
1 Replies
3. Shell Programming and Scripting
:confused:
Hi Friends,
In the record below i have to make changes in the fields by putting the values stored in the temporary variables, x, y, z, p, q, r:
2) In the TBT record store the values in the various fields as:
a) X in a field position 51 to 56
b) Y... (5 Replies)
Discussion started by: kanu_pathak
5 Replies
4. Shell Programming and Scripting
Hi,
I have a fixed width file with record length 10.
I need to remove multiple newline characters present in each record.
EX:
af\n72/7\n
s\n3\nad\n
2\n\n33r\n
In the above file I want to remove new lines in red color(\n) but not (\n)
Please provide me a solution.
Thanks,
Sri (1 Reply)
Discussion started by: srilaxmi
1 Replies
5. Shell Programming and Scripting
I have
a='123, abc, def, ghi'
var1=`echo $a | awk -F", " '{print RS $1}'`
echo "something: $var1"
which outputs
something
123
how can I tell awk not to put a newline between fields? I want it to output:
something: 123 (4 Replies)
Discussion started by: unclecameron
4 Replies
6. Shell Programming and Scripting
Hi,
I have a very huge file, around 1GB of data.
I want to remove the newline characters in the file but not preceded by the original end delimiter {}
sample data will look like this
1234567
abcd{}
1234sssss
as67
abcd{}
12dsad3dad
4sdad567
abcdsadd{}
this should look like this... (6 Replies)
Discussion started by: ratheeshjulk
6 Replies
7. Shell Programming and Scripting
My source file is pipe delimeted file with 53 fields.In 33 rd column i am getting mutlple new line characters,dule to that record is breaking into multiple records.
Note : here record delimter also \n
sample Source file with 6 fields :
1234|abc| \nabcd \n bvd \n cde \n |678|890|900\n
... (6 Replies)
Discussion started by: lakshmi001
6 Replies
8. Shell Programming and Scripting
Sample file record :
"20130617003","2013-06-18T07:00:03","OUTWARD","01001011","TEST PLC","","HFX834346364364","20130617","10","DUM87534758","","1.28","826","020201","65879278","","","","","","010101","56789","DUMMY... (3 Replies)
Discussion started by: bigbuk
3 Replies
9. Shell Programming and Scripting
I'm trying to compare 2 files for differences in a selct number of fields. When differnces are found it will write the whole record of the second file including appending '|C' out to a delta file. Each record will have 20 fields, but only want to do comparison of 1st 15 fields. The 1st field of... (7 Replies)
Discussion started by: sljnk
7 Replies
10. Shell Programming and Scripting
Hi All,
I receive a | delimited text file containing 63 columns. There is no delimiter at the end of the 63rd field, instead there would be a newline character at the end of the text in 63rd column. I wanted to retain this newline character at the end of the 63rd column, as it is desired newline... (1 Reply)
Discussion started by: sagarparadkar
1 Replies
LIBBASH(7) libbash Manual LIBBASH(7)
NAME
libbash -- A bash shared libraries package.
DESCRIPTION
libbash is a package that enables bash dynamic-like shared libraries. Actually its a tool for managing bash scripts whose functions you may
want to load and use in scripts of your own.
It contains a 'dynamic loader' for the shared libraries ( ldbash(1)), a configuration tool (ldbashconfig(8)), and some libraries.
Using ldbash(1) you are able to load loadable bash libraries, such as getopts(1) and hashstash(1). A bash shared library that can be loaded
using
ldbash(1) must answer 4 requirments:
1. It must be installed in $LIBBASH_PREFIX/lib/bash (default is /usr/lib/bash).
2. It must contain a line that begins with '#EXPORT='. That line will contain (after the '=') a list of functions that the library
exports. I.e. all the function that will be usable after loading that library will be listed in that line.
3. It must contain a line that begins with '#REQUIRE='. That line will contain (after the '=') a list of bash libraries that are
required for our library. I.e. every bash library that is in use in our bash library must be listed there.
4. The library must be listed (For more information, see ldbashconfig(8)).
Basic guidelines for writing library of your own:
1. Be aware, that your library will be actually sourced. So, basically, it should contain (i.e define) only functions.
2. Try to declare all variables intended for internal use as local.
3. Global variables and functions that are intended for internal use (i.e are not defined in '#EXPORT=') should begin with:
__<library_name>_
For example, internal function myfoosort of hashstash library should be named as
__hashstash_myfoosort
This helps to avoid conflicts in global name space when using libraries that come from different vendors.
4. See html manual for full version of this guide.
AUTHORS
Hai Zaar <haizaar@haizaar.com>
Gil Ran <ril@ran4.net>
SEE ALSO
ldbash(1), ldbashconfig(8), getopts(1), hashstash(1) colors(1) messages(1) urlcoding(1) locks(1)
Linux Epoch Linux