10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi
How to remove white space from this input:|blue | 1|
|green| 4|
|black| 2|
I like to search for green and get 4not 4
How to modify this to work correct:awk -F"|" '/green/ {print $3} (7 Replies)
Discussion started by: Jotne
7 Replies
2. Shell Programming and Scripting
Hi,
I'm fairly new to scripting and I have a problem that I am having difficulty solving.
What I'd like to do is run an awk script to adjust the string in the first field depending on the string in another field. This is best explained with an example:
Here is my script:
cat... (4 Replies)
Discussion started by: calbrex
4 Replies
3. Shell Programming and Scripting
I have an AWK script that uses multiple delimiters in the FS variable.
FS="+"
My awk script takes a file name such as this:
12345_smith_bubba_12345_20120215_4_0.pdf and parses it out based on the under score. Each parsed field then has some code for data validation etc.
This script has... (12 Replies)
Discussion started by: reno4me
12 Replies
4. Shell Programming and Scripting
Hi,
I have a large flat file from host without delimiter. I'm transforming this file to a csv file using statements like
# Row 03: Customer / field position 3059 +20
WOFABNAM=substr( $0, 3059, 20 );
and deleting the trailing whitespaces before and after with that
sub( /^ +/, "",... (4 Replies)
Discussion started by: Celald
4 Replies
5. Shell Programming and Scripting
I have a question about nested double quotes. Any help is appreciated.
Here are my commands on Mac OS.
# string="Ethernet \"USB Ethernet\" \"Bluetooth DUN\" AirPort FireWire \"Bluetooth PAN\""
# echo $string
Ethernet "USB Ethernet" "Bluetooth DUN" AirPort FireWire "Bluetooth PAN"
#... (3 Replies)
Discussion started by: lindazhou
3 Replies
6. Shell Programming and Scripting
Hello.
I'm using a file to "grep" in a 2nd one (with awk)
cat file1
2 first user
9 second user
1 third user (with a space after user)
I want to get the line except the 1st field so I do :
field=$(gawk '{$1 =""; print $0}' file | sed 's/^ //')
It works but it deletes... (5 Replies)
Discussion started by: xanthos
5 Replies
7. Programming
I am coding a C program to read a plain text file. There are a lot of blank fields or a string with white spaces. I want to know is there such a function called trim() in C to clean the white space around a string? Or some other way can do this efficiently? Thanks. (18 Replies)
Discussion started by: hxm1303
18 Replies
8. Shell Programming and Scripting
Hi,
I want to get the value of the first field till space in a variable.
e.g x=323 /test/personel/logs/File1
I want to get the first field till space i.e 323 in another variable ,lets say y.
echo $x|cut -d' ' -f1 gives 323
but when I'm trying y=`echo $x|cut -d' ' -f1 its giving... (3 Replies)
Discussion started by: autosys_nm
3 Replies
9. Shell Programming and Scripting
Hi,
I have a CSV file with footer information as below. The third value is the number of records in the file. Sometimes it contains both leading and trailing white spaces which i want to trim using awk.
C,FOOTER , 00000642
C,FOOTER , 00000707
C, FOOTER,... (2 Replies)
Discussion started by: mona
2 Replies
10. Shell Programming and Scripting
Hi ,
I have a code like this:
uid=scott
password=tiger
database=db01
cat >runid_val.sql<<-EOA
SET ECHO OFF
SET FEEDBACK OFF
SET HEADING OFF
SELECT trim(runid_seq.nextval) FROM dual;
EXIT
EOA
echo `cat runid_val.sql`
V_RUNID=`sqlplus -s $uid/$password@$database @runid_val.sql`... (5 Replies)
Discussion started by: vj_76
5 Replies