Search Results

Search: Posts Made By: locoroco
1,110
Posted By Scrutinizer
Try: sed 1d file > newfiletail -n+2 file >...
Try:
sed 1d file > newfiletail -n+2 file > newfileawk NR-1 file > newfile With bash:
{
read
while IFS= read -r line
do
printf "%s\n" "$line"
done
} < file > newfile
643
Posted By bakunin
I am not exactly sure what you are trying to...
I am not exactly sure what you are trying to achieve here with the subshells and the echos. If you want to assign a string to a variable you simply do:
...
1,420
Posted By Don Cragun
I wouldn't call this sorting. But the following...
I wouldn't call this sorting. But the following brute force awk script seems to do what your want:
awk '
NR == 1 {
l1 = $0
printf("%s", $0)
combine = 1
next
}...
3,378
Posted By MadeInGermany
sed 's/\([A-Z]\)\.\([A-Z]\)/\1. \2/g'\1 is the...
sed 's/\([A-Z]\)\.\([A-Z]\)/\1. \2/g'\1 is the 1st matching \(...\) etc.
3,173
Posted By Chubler_XL
Try: awk -v str="$str" '$0 ~ str'...
Try:

awk -v str="$str" '$0 ~ str' file
23,021
Posted By rdrtx1
try also: typeset -u fl while read -a line ...
try also:
typeset -u fl
while read -a line
do
c=0
for word in ${line[@]}
do
fl=${word[@]:0:1}
line[$c]="$fl${word[@]:1}"
(( c = c + 1 ))
done
echo ${line[@]}
done <...
23,021
Posted By Corona688
Had this sitting around. Use nawk on solaris. ...
Had this sitting around. Use nawk on solaris.
awk 'function titlecase(STR, N, M, A, OUT)
{
OUT=""
N=split(STR, A, " ");
for(M=1; M<=N; M++)
{
...
23,021
Posted By Yoda
In BASH using tr command: #!/bin/bash for...
In BASH using tr command:
#!/bin/bash

for words in are utilities ready for hurricane sandy
do
for((i=0;i<${#words};i++))
do
if [ $i -eq 0 ]
then
echo -e...
5,805
Posted By pamu
It always good to provide your input and desired...
It always good to provide your input and desired output.

try this..

To remove - if it is present at the start of the line.
awk '{ sub("^-","",$0)}1' fileTo remove first instance of -

awk '{...
3,319
Posted By Corona688
-F is just the input field separator. The output...
-F is just the input field separator. The output field separator is controlled by the special variable OFS.

awk '{ ... }' OFS=";" filename
18,490
Posted By Chubler_XL
Try: curl -d "$(eval echo \"$datestring\")"...
Try:

curl -d "$(eval echo \"$datestring\")" -b cookie.txt -c cookie.txt -L "$url"
18,490
Posted By Chubler_XL
So is it just $datastring that contains...
So is it just $datastring that contains $variables that you need to expand?

Edit: Yes, the expanded $url variable will need to be quoted to ensure the shell dosn't intrepret anything within it....
18,490
Posted By Chubler_XL
Double quotes aren't so good if URL contains a...
Double quotes aren't so good if URL contains a dollar sign ($), the shell will try and expand it.
18,490
Posted By Chubler_XL
Perhaps the URL contains a ampersand (&)...
Perhaps the URL contains a ampersand (&) character causing the curl to be run in the background.

Why do you need to do an eval instead of invoking curl directly?

For debuging purposes try...
5,748
Posted By michaelrozar17
Remove the 2nd append string 'a' and try.. sed...
Remove the 2nd append string 'a' and try..
sed '/patternstring/ a\
new line string \
new line string 2' file1
1,864
Posted By ahamed101
Paste the output of cat -A input_file Are...
Paste the output of cat -A input_file

Are you telling that the file is unchanged? Of course it will not get modified.


awk '!/^[ \t]*$/' input_file > out_file

#or use sed -i to change...
1,864
Posted By balajesuri
perl -ne '(!/^\s+/)&&print' inputfile ...
perl -ne '(!/^\s+/)&&print' inputfile
@locoroco: ahmed101's solution works perfectly.

@CarloM: sed '/^[[:space:]]*$/d'
1,864
Posted By itkamaraj
grep -v . inputfile > outputfile
grep -v . inputfile > outputfile
1,864
Posted By ahamed101
You want to remove empty lines? awk...
You want to remove empty lines?


awk '!/^[ \t]*$/' input_file


--ahamed
1,864
Posted By CarloM
Try sed '/^[:space:]*$/d'.
Try sed '/^[:space:]*$/d'.
1,864
Posted By balajesuri
I understand now. I had faced a similar situation...
I understand now. I had faced a similar situation before. The output.dat file I got from wget -qO output.dat <hostname> had a ^M at the end of every line. This happens when format of file is...
2,047
Posted By ahamed101
Paste a sample input!... --ahamed ...
Paste a sample input!...

--ahamed

---------- Post updated at 04:46 AM ---------- Previous update was at 04:37 AM ----------

Try this...

awk -F"[{}:,]" '{for(i=1;i<=NF;i++){if($i ~...
2,047
Posted By ahamed101
Try the code in the previous post and let me know...
Try the code in the previous post and let me know if it works for you...

--ahamed
785
Posted By Scott
As a rule-of-thumb, you should always...
As a rule-of-thumb, you should always double-quote variables.

What happens with:

mv "$oldfilename" "$newfilename"
4,248
Posted By agama
Maybe not the best solution, but for something in...
Maybe not the best solution, but for something in pure shell, and a few minutes effort, it'll at lest serve as an example:


#!/usr/bin/env ksh
# or for bash put next line at top
#!/usr/bin/env...
Showing results 1 to 25 of 46

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