Search Results

Search: Posts Made By: lxdorney
2,221
Posted By RudiC
Didn't you "need it to turn it into an XML file...
Didn't you "need it to turn it into an XML file for each row"? Tryawk -v FS="," '
FNR == 1 {split (tolower($0), tags)
next
}
{print "<?xml...
2,221
Posted By RavinderSingh13
Hello lxdorney, Could you please try...
Hello lxdorney,

Could you please try following, not tested it though.

awk -v FS="," 'BEGIN{
qq="\""
}
FNR==1{
for(i=1;i<=NF;i++)
tags[i]=tolower($i)
print "<?xml version=" qq...
2,221
Posted By vgersh99
something to start with: awk -F, -f lx.awk...
something to start with: awk -F, -f lx.awk myFile.csv
where lx.awk is:

BEGIN {
qq="\""
}
FNR==1{
for(i=1;i<=NF;i++)
tags[i]=tolower($i)
print "<?xml version=" qq "1.0" qq...
1,150
Posted By RudiC
Not sure what exactly the output should look...
Not sure what exactly the output should look like, but try alsopaste -sd"\t\t\t\t\n" file
Description: Description1 Link: https://www.google.com Date: June 2, 2018 Time: 00:07:44 Age: 1 days ago...
1,150
Posted By jgt
IFS=":" while read desc DESC do read...
IFS=":"
while read desc DESC

do
read link LINK
read date DATE
read time TIME
read age AGE
echo "$DESC \t $LINK \t $DATE \t $TIME \t $AGE"
done


you may need to use...
831
Posted By RudiC
One option: awk '{while (!/"$/) {getline X; $0...
One option:
awk '{while (!/"$/) {getline X; $0 = $0 " " X}; gsub (/ *" */, _)} 1' file
test1 test1
test1 test1 test1 test1
test1 test1 test1 test1 test1 test1
or
sed '{:L; N; $!bL;}; s/\n/ /g;...
6,991
Posted By Don Cragun
You haven't said what shell or operating system...
You haven't said what shell or operating system you're using. When I try the following script on a macBook Pro running macOS Sierra version 10.12.6 using ksh (version sh (AT&T Research) 93u+...
2,241
Posted By blastit.fr
Another way is to considere any line whith no...
Another way is to considere any line whith no visible character as a paragraph separator.
Using blank as the default separator , the awk NF variable will by equal to 0 in case you have either blank...
2,241
Posted By Scrutinizer
Note: only GNU awk and mawk can use a Regex...
Note: only GNU awk and mawk can use a Regex expression for the RS variable. Other awks only take a single (leftmost) character
for RS...

An alternative that should work in any modern Posix awk...
2,241
Posted By greet_sed
yes, as per your post#1 input, between paragraphs...
yes, as per your post#1 input, between paragraphs you had blank line. However in post#4, files shared in googledrive, has a space in those lines. Hence those commands didnt perform what you wanted.
...
Forum: Linux 05-20-2016
7,514
Posted By bakunin
Alas, there is indeed a "brilliant idea", but you...
Alas, there is indeed a "brilliant idea", but you probably are not going to like it: write a parser!

The solution you found (and which is similar to many others, including a few of my own) will...
1,623
Posted By Aia
Sure. If it matches the pattern within the...
Sure.
If it matches the pattern within the slashes execute the actions within the block {}. The block actions are, replace empty for the first matched group and print and quit.

The Perl line does...
1,623
Posted By Aia
sed -n '/\(.\{99,154\}[^0-9]\.\).*/ {s//\1/p;q}'...
sed -n '/\(.\{99,154\}[^0-9]\.\).*/ {s//\1/p;q}' test.txt

With Perl:
perl -nle '/.{99,154}\D\./ and print $& and last' test.txt
2,677
Posted By neutronscott
you've a DOS formatted file then. first convert...
you've a DOS formatted file then. first convert it to unix, or amend the script like so:


awk '{sub(/\r$/,"")}NF {print "<p align=\"justify\"> " $0 " </p>"}' file.txt
2,677
Posted By Aia
You don't need to use cat. Awk can read files on...
You don't need to use cat. Awk can read files on its own.

Here's another way without Awk.
perl -nle 'print "<p align=\"justify\">$_</p>" unless /^$/' file.txt
2,677
Posted By MadeInGermany
The following takes advantage of awk's autosplit...
The following takes advantage of awk's autosplit on whitespace.
awk 'NF {print "<p align=\"justify\"> " $0 " </p>"}' file.txtIf you want to keep the blank lines:
awk 'NF {$0 = "<p...
2,677
Posted By RudiC
If you want to exclude lines containing <TAB>s...
If you want to exclude lines containing <TAB>s and spaces as well, try awk '!/^[\t ]*$/ {print "<p align=\"justify\"> " $0 " </p>"}' file
2,677
Posted By RavinderSingh13
Hello lxdorney, If I understood correctly...
Hello lxdorney,

If I understood correctly you need to skip those lines which are empty, then you can try following. It is good you are showing us what you have tried so far, please try to add...
1,824
Posted By Don Cragun
Although the above works with some versions of...
Although the above works with some versions of awk, the standards say the only backslash escapes that are required to be recognized by awk are:\\, \/, \", \a, \b, \f, \n, \r, \t, and \v, and \d, \dd,...
1,824
Posted By Akshay Hegde
In current context, you can simplify like this...
In current context, you can simplify like this also

[akshay@localhost tmp]$ cat file
[A.B. No. T-8346, January 01, 2015 ]
JHON VS. PETER, AGOO PET.

How Old Are You
[A.C. No. T-8346,...
1,824
Posted By RavinderSingh13
Hello lxdorney, Following is the explanation...
Hello lxdorney,

Following is the explanation for same, hope that helps you. Also please always do show us your efforts as we all are here to learn. You can hit thanks button present at bottom of...
4,481
Posted By Chubler_XL
Put semi-colons (;) where the carrot (^)...
Put semi-colons (;) where the carrot (^) characters are pointing:

awk '/<div id=\"left\"/ {P++} P {if (/<div>/) P++; if (/<\/div>/) P--; print}' file
3,220
Posted By cfajohnson
awk 'BEGIN { print "<div align=center>" } {...
awk 'BEGIN { print "<div align=center>" }
{ gsub(/&/,"&amp;"); gsub(/</,"&lt;") }
/^$/ { print; last = "blank"; next }
last == "blank" || NR == 1 {
last = ""
printf " <p>"
}
/THE DISTRICT COURT...
3,220
Posted By RudiC
Any idea from your side? ---------- Post...
Any idea from your side?

---------- Post updated 02-07-15 at 00:02 ---------- Previous update was 01-07-15 at 23:56 ----------

However, try tac file | awk '
/Unique/ {T=NR+2}
NR...
3,220
Posted By RudiC
You could replace the /Uniquerow/ match by e.g. a...
You could replace the /Uniquerow/ match by e.g. a /COUTRHR/ match, but I assume this would not work with the other thousands of files.

It's not that easy to apply a selection / decision to a line...
Showing results 1 to 25 of 31

 
All times are GMT -4. The time now is 01:32 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy