2016-03-30 11 views
0

私はコマンドラインでチュートリアルをしています。演習の1つでは、sonnetechoをコピーして新しいファイルに貼り付ける必要があります。 問題は、新しいファイルが新しいファイルに存在しないことです。実際には、ファイルがcatの場合、各詩は前のファイルに紐付けられています。txtファイルにコピー、ペースト、エコーします。

各行の最後に手動で"\n"を追加する必要がありますか。 (1000行がある場合はどうするので?) 私はより良い方法があると思います

UPDATE: これは私がhereからソネットをコピーし、今までの

ファーストを行っているものです。それから私は、このコマンドを記述するために、端末に貼り付け:

~$ echo "FRom faireſt creatures we deſire increaſe, That thereby beauties Roſe might neuer die, But as the riper ſhould by time deceaſe, His tender heire might beare his memory: But thou contracted to thine owne bright eyes, Feed’ſt thy lights flame with ſelfe ſubſtantiall fewell, Making a famine where aboundance lies, Thy ſelfe thy foe,to thy ſweet ſelfe too cruell: Thou that art now the worlds freſh ornament, And only herauld to the gaudy ſpring, Within thine owne bud burieſt thy content, And tender chorle makſt waſt in niggarding: Pitty the world,or elſe this glutton be, To eate the worlds due,by the graue and thee." > sonnet.txt 

は最終的に私が内容を確認します

cat sonnet.txt 

を私が取得:これはソネットのために動作します

FRom faireſt creatures we deſire increaſe, That thereby beauties Roſe might neuer die, But as the riper ſhould by time deceaſe, His tender heire might beare his memory: But thou contracted to thine owne bright eyes, Feed’ſt thy lights flame with ſelfe ſubſtantiall fewell, Making a famine where aboundance lies, Thy ſelfe thy foe,to thy ſweet ſelfe too cruell: Thou that art now the worlds freſh ornament, And only herauld to the gaudy ſpring, Within thine owne bud burieſt thy content, And tender chorle makſt waſt in niggarding: Pitty the world,or elſe this glutton be, To eate the worlds due,by the graue and thee. 
+0

sonnet_の_copy-pasteを取得できませんでした。 _sonnet_は文字ファイルなのですか? – Mahendra

+0

これを行うためにどのようなコマンドを使用していますか? 'echo [paste]> file'?ペーストされた内容には、各節の間に空白の行がありますか? –

+0

@Mahendra、申し訳ありませんが、私はリンクを入れて忘れました – Pigna

答えて

0

:)

$ sonnet="Shall I compare thee to a summer.s day? 
> Thou art more lovely and more temperate. 
> Rough winds do shake the darling buds of May," 

$ echo "$sonnet" 
Shall I compare thee to a summer.s day? 
Thou art more lovely and more temperate. 
Rough winds do shake the darling buds of May, 

私はあなたが欠けていると思う可愛い引用符。

$ echo $sonnet 
Shall I compare thee to a summer.s day? Thou art more lovely and more temperate. Rough winds do shake the darling buds of May, 
+0

それは動作していません。リンクを見てください(私は前に置くのを忘れました)。コピーして貼り付けてから、txtファイルにエコーしてみてください。改行はどうやって保管していますか? – Pigna

+0

は、どのソネット/テキストを使用してもかまいません。あなたは引用符に注意を払ったのですか?変数を定義するときとエコーバックするときの両方。元の投稿に使用している正確なコマンドを投稿してください。おそらくあなたは何か他のことをしているでしょう... – karakfa

+0

1.ページ内のソネットを強調表示します。2. ctrl-c 3.端末 "echo"をタイプします。4. "$ [paste]"とタイプし、 > sonnet.txt "、6. Enterをクリックします – Pigna

関連する問題